﻿namespace jzgl.Windows
{
    //using AdvancedDataGridView;
    using DataGridViewPrint;
    using Excel;
    using jzgl.Controller;
    using jzgl.Model;
    using System;
    using System.Collections.Generic;
    using System.ComponentModel;
    using System.Data;
    using System.Drawing;
    using System.Drawing.Printing;
    using System.IO;
    using System.Text;
    using System.Text.RegularExpressions;
    using System.Windows.Forms;

    public class HouseTypeInfo : Form
    {
        private int AddNO;
        private int Adds;
        private BudgetBargainDB barDB;
        private System.Windows.Forms.Button btn_DaoChu;
        private System.Windows.Forms.Button btn_Delete_Budget;
        private System.Windows.Forms.Button btn_Mater;
        private System.Windows.Forms.Button btn_New_budget;
        private System.Windows.Forms.Button btn_Print;
        private System.Windows.Forms.Button btn_QueDing;
        private System.Windows.Forms.Button btn_Save;
        private System.Windows.Forms.Button btn_SheJiTu_mingxi;
        private System.Windows.Forms.Button btn_YuSuan_mingxi;
        private System.Windows.Forms.Button btnCopyBudget;
        private System.Windows.Forms.Button btnHidden;
        public static string budget_id = "";
        private int bz;
        private int c;
        private DataGridViewTextBoxColumn clmAboutRead;
        private DataGridViewTextBoxColumn clmId;
        private TreeGridColumn clmItem;
        private DataGridViewTextBoxColumn clmNum;
        private DataGridViewTextBoxColumn clmTotalAmount;
        private DataGridViewTextBoxColumn clmUnit;
        private DataGridViewTextBoxColumn clmUnitPrice;
        private DataGridViewTextBoxColumn Column1;
        private DataGridViewTextBoxColumn Column2;
        private DataGridViewTextBoxColumn Column3;
        private DataGridViewTextBoxColumn Column4;
        private DataGridViewTextBoxColumn Column5;
        private DataGridViewTextBoxColumn Column6;
        private DataGridViewTextBoxColumn Column7;
        private DataGridViewTextBoxColumn Column8;
        private ComboBox comboBox_MaterType;
        private IContainer components;
        private ContextMenuStrip contextMenuStrip1;
        private string[] copy;
        private DataGridView dataGridView1;
        private DataGridView dataGridView2;
        private DataGridViewTextBoxColumn dataGridViewTextBoxColumn1;
        private DataGridViewTextBoxColumn dataGridViewTextBoxColumn10;
        private DataGridViewTextBoxColumn dataGridViewTextBoxColumn11;
        private DataGridViewTextBoxColumn dataGridViewTextBoxColumn2;
        private DataGridViewTextBoxColumn dataGridViewTextBoxColumn3;
        private DataGridViewTextBoxColumn dataGridViewTextBoxColumn4;
        private DataGridViewTextBoxColumn dataGridViewTextBoxColumn5;
        private DataGridViewTextBoxColumn dataGridViewTextBoxColumn6;
        private DataGridViewTextBoxColumn dataGridViewTextBoxColumn7;
        private DataGridViewTextBoxColumn dataGridViewTextBoxColumn8;
        private DataGridViewTextBoxColumn dataGridViewTextBoxColumn9;
        private int delCount;
        private DesignerDB desDB;
        private BudgetDetailsDB detailsDB;
        private System.Data.DataTable dt;
        private System.Data.DataTable dTable;
        private int er;
        private int er_a;
        private int er2;
        public string FileNodeName;
        private int fj;
        private int fj_copy_index;
        private string fj_index;
        private System.Windows.Forms.GroupBox groupBox1;
        private string h;
        private string homeType;
        private ImageList imageList1;
        private ImageList imageStrip;
        private BudgetInfoDB infoDB;
        private string[] item;
        private float item_money;
        private System.Windows.Forms.Label label1;
        private System.Windows.Forms.Label label10;
        private System.Windows.Forms.Label label11;
        private System.Windows.Forms.Label label12;
        private System.Windows.Forms.Label label13;
        private System.Windows.Forms.Label label14;
        private System.Windows.Forms.Label label15;
        private System.Windows.Forms.Label label16;
        private System.Windows.Forms.Label label17;
        private System.Windows.Forms.Label label18;
        private System.Windows.Forms.Label label19;
        private System.Windows.Forms.Label label2;
        private System.Windows.Forms.Label label20;
        private System.Windows.Forms.Label label21;
        private System.Windows.Forms.Label label22;
        private System.Windows.Forms.Label label23;
        private System.Windows.Forms.Label label24;
        private System.Windows.Forms.Label label25;
        private System.Windows.Forms.Label label26;
        private System.Windows.Forms.Label label27;
        private System.Windows.Forms.Label label28;
        private System.Windows.Forms.Label label29;
        private System.Windows.Forms.Label label3;
        private System.Windows.Forms.Label label30;
        private System.Windows.Forms.Label label34;
        private System.Windows.Forms.Label label4;
        private System.Windows.Forms.Label label5;
        private System.Windows.Forms.Label label6;
        private System.Windows.Forms.Label label7;
        private System.Windows.Forms.Label label8;
        private System.Windows.Forms.Label label9;
        private System.Windows.Forms.Label lbl_address;
        private System.Windows.Forms.Label lbl_area;
        private System.Windows.Forms.Label lbl_cust_idea;
        private System.Windows.Forms.Label lbl_custname;
        private System.Windows.Forms.Label lbl_designer;
        private System.Windows.Forms.Label lbl_GongChang;
        private System.Windows.Forms.Label lbl_HeTong_price;
        private System.Windows.Forms.Label lbl_housetype;
        private System.Windows.Forms.Label lbl_HuXing;
        private System.Windows.Forms.Label lbl_phone;
        private System.Windows.Forms.Label lbl_Qiandan_date;
        private System.Windows.Forms.Label lbl_SheJiTu;
        private System.Windows.Forms.Label lbl_ShiGong_date;
        private System.Windows.Forms.Label lbl_style;
        private System.Windows.Forms.Label lbl_YuSuan;
        private System.Windows.Forms.Label lblCustomer;
        private System.Windows.Forms.Label lblCustomerName;
        private System.Windows.Forms.Label lblCustomerPhone;
        private System.Windows.Forms.Label lblDesigner;
        private System.Windows.Forms.Label lblProAddress;
        private BudgetList list;
        private List<BudgetDetails> listBudgetDetailNodes;
        private BudgetListDB listDB;
        private List<jzgl.Model.BudgetInfo> listNodes;
        private MaterInfoDB materDB;
        private List<MaterInfo> materList;
        public static int mouseState = 0;
        public string oldkey;
        private OpenFileDialog openFileDialog1;
        private PageSetupDialog pageSetupDialogBill;
        private Panel panel1;
        private Panel panel1111;
        private Panel panel2;
        private Panel panel3;
        private Panel panel4;
        private Panel panel5;
        private Panel panel7;
        private Panel pnlNewBudget;
        private Panel pnlNewBudTop;
        private Panel pnlSelectHouse;
        private PrintDocument printDocumentBill;
        private PrintPreviewDialog printPreviewDialogBill;
        private int s;
        private int san;
        private string[] save_budget;
        private List<int> save_score1;
        private List<int> save_sore;
        private int saveIndex;
        private SplitContainer splitContainer1;
        private DesStyleDB styleDB;
        private System.Data.DataTable table;
        private TabPage tbpHouseType;
        private TabPage tbpItemInfo;
        private TabPage tbpNewBudget;
        private TabControl tclHNM;
        private System.Windows.Forms.TextBox textBox1;
        private TreeGridView tgdvTest;
        private float total;
        private float total_money;
        private TreeView treeView1;
        private System.Windows.Forms.TextBox txt_chufang;
        private System.Windows.Forms.TextBox txt_chuwujian;
        private System.Windows.Forms.TextBox txt_guodao;
        private System.Windows.Forms.TextBox txt_louti;
        private System.Windows.Forms.TextBox txt_qita;
        private System.Windows.Forms.TextBox txt_shi;
        private System.Windows.Forms.TextBox txt_shuidian;
        private System.Windows.Forms.TextBox txt_ting;
        private System.Windows.Forms.TextBox txt_wei;
        private System.Windows.Forms.TextBox txt_xuanguan;
        private System.Windows.Forms.TextBox txt_yangtai;
        private System.Windows.Forms.TextBox txtNewBudgetTitle;
        private MaterTypeDB typeDB;
        private SysUserDB userDB;
        private string userId;
        private ToolStripMenuItem 附加项目ToolStripMenuItem;
        private ToolStripMenuItem 复制单元项目ToolStripMenuItem;
        private ToolStripMenuItem 删除施工单元ToolStripMenuItem;
        private ToolStripMenuItem 添加施工单元ToolStripMenuItem;
        private ToolStripMenuItem 修改单元格名称ToolStripMenuItem;
        private ToolStripMenuItem 选择施工项目ToolStripMenuItem;
        private ToolStripMenuItem 粘贴单元项目ToolStripMenuItem;

        public HouseTypeInfo()
        {
            this.components = null;
            this.desDB = new DesignerDB();
            this.styleDB = new DesStyleDB();
            this.typeDB = new MaterTypeDB();
            this.materDB = new MaterInfoDB();
            this.list = new BudgetList();
            this.listDB = new BudgetListDB();
            this.infoDB = new BudgetInfoDB();
            this.barDB = new BudgetBargainDB();
            this.detailsDB = new BudgetDetailsDB();
            this.userDB = new SysUserDB();
            this.table = null;
            this.dTable = null;
            this.c = 1;
            this.h = "";
            this.item_money = 0f;
            this.total_money = 0f;
            this.dt = null;
            this.materList = null;
            this.save_budget = new string[10];
            this.item = new string[10];
            this.copy = new string[10];
            this.userId = "";
            this.er = 0;
            this.er2 = 0;
            this.san = 0;
            this.er_a = 0;
            this.fj_index = "";
            this.fj = 0;
            this.bz = 0;
            this.fj_copy_index = -1;
            this.saveIndex = 0;
            this.save_sore = new List<int>();
            this.save_score1 = new List<int>();
            this.AddNO = 0;
            this.InitializeComponent();
            budget_id = "";
            this.save_budget[0] = "";
            this.save_budget[1] = "";
            this.save_budget[2] = "";
            this.save_budget[3] = "";
            this.save_budget[4] = "";
            this.save_budget[5] = "";
            this.copy[0] = "";
            this.copy[1] = "";
            this.copy[2] = "";
            this.copy[3] = "";
            this.copy[4] = "";
            this.copy[5] = "";
            this.copy[6] = "";
            this.copy[7] = "";
        }

        public HouseTypeInfo(string user, int p)
        {
            this.components = null;
            this.desDB = new DesignerDB();
            this.styleDB = new DesStyleDB();
            this.typeDB = new MaterTypeDB();
            this.materDB = new MaterInfoDB();
            this.list = new BudgetList();
            this.listDB = new BudgetListDB();
            this.infoDB = new BudgetInfoDB();
            this.barDB = new BudgetBargainDB();
            this.detailsDB = new BudgetDetailsDB();
            this.userDB = new SysUserDB();
            this.table = null;
            this.dTable = null;
            this.c = 1;
            this.h = "";
            this.item_money = 0f;
            this.total_money = 0f;
            this.dt = null;
            this.materList = null;
            this.save_budget = new string[10];
            this.item = new string[10];
            this.copy = new string[10];
            this.userId = "";
            this.er = 0;
            this.er2 = 0;
            this.san = 0;
            this.er_a = 0;
            this.fj_index = "";
            this.fj = 0;
            this.bz = 0;
            this.fj_copy_index = -1;
            this.saveIndex = 0;
            this.save_sore = new List<int>();
            this.save_score1 = new List<int>();
            this.AddNO = 0;
            budget_id = "";
            this.save_budget[0] = "";
            this.save_budget[1] = "";
            this.save_budget[2] = "";
            this.save_budget[3] = "";
            this.save_budget[4] = "";
            this.save_budget[5] = "";
            this.copy[0] = "";
            this.copy[1] = "";
            this.copy[2] = "";
            this.copy[3] = "";
            this.copy[4] = "";
            this.copy[5] = "";
            this.copy[6] = "";
            this.copy[7] = "";
            this.InitializeComponent();
            this.userId = user;
            this.tclHNM.TabPages.Remove(this.tbpHouseType);
            this.tclHNM.TabPages.Remove(this.tbpNewBudget);
            this.tclHNM.TabPages.Remove(this.tbpItemInfo);
            if (p == 1)
            {
                this.tclHNM.TabPages.Add(this.tbpHouseType);
            }
            if (p == 2)
            {
                this.tclHNM.TabPages.Add(this.tbpNewBudget);
            }
            if (p == 3)
            {
                this.tclHNM.TabPages.Add(this.tbpItemInfo);
            }
            if (p == 4)
            {
                if (this.importNewBudget())
                {
                    this.tclHNM.TabPages.Add(this.tbpNewBudget);
                    System.Data.DataTable table = this.listDB.Show_BudgetListBy_BudlistId(budget_id);
                    if (table.Rows.Count != 0)
                    {
                        this.lbl_HuXing.Text = table.Rows[0][6].ToString();
                        this.lblCustomer.Text = table.Rows[0][2].ToString();
                    }
                }
                else
                {
                    this.tclHNM.TabPages.Add(this.tbpHouseType);
                }
            }
            this.ComboBox_bind();
            this.Data_bind();
            this.add_menu();
        }

        public void add_menu()
        {
            try
            {
                TreeNode node2;
                int num3;
                TreeNode node3;
                int num = 0;
                this.dTable = this.userDB.Show_SysUser(this.userId);
                TreeNode node = new TreeNode();
                node.Text = "按设计师分类";
                if (this.dTable.Rows[0][4].ToString().Trim().Contains("普通用户"))
                {
                    this.table = this.userDB.Show_SysUser(this.userId);
                }
                else
                {
                    this.table = this.userDB.Show_SysUser();
                }
                int index = 0;
                while (index < this.table.Rows.Count)
                {
                    node2 = new TreeNode();
                    node2.Text = this.table.Rows[index][2].ToString().Trim();
                    node2.ImageIndex = 1;
                    node2.Tag = this.table.Rows[index][1].ToString().Trim();
                    if (this.dTable.Rows[0][4].ToString().Trim().Contains("普通用户"))
                    {
                        this.dt = this.listDB.Show_BudgetListBy_Designer(this.userId, this.table.Rows[index][2].ToString().Trim());
                        num = 1;
                    }
                    else
                    {
                        this.dt = this.listDB.Show_BudgetListBy_Designer(this.table.Rows[index][2].ToString().Trim());
                    }
                    num3 = 0;
                    while (num3 < this.dt.Rows.Count)
                    {
                        node3 = new TreeNode();
                        node3.Text = this.dt.Rows[num3][12].ToString().Trim();
                        node3.ImageIndex = 5;
                        node3.Tag = this.dt.Rows[num3][1].ToString().Trim();
                        node2.Nodes.Insert(index, node3);
                        num3++;
                    }
                    node.Nodes.Add(node2);
                    node.Expand();
                    if (num == 1)
                    {
                        num = 0;
                        break;
                    }
                    index++;
                }
                node.ImageIndex = 0;
                this.treeView1.Nodes.Add(node);
                TreeNode node4 = new TreeNode();
                node4.Text = "按装修风格分类";
                this.table = this.styleDB.Show_DesStyle();
                for (index = 0; index < this.table.Rows.Count; index++)
                {
                    node2 = new TreeNode();
                    node2.Text = this.table.Rows[index][1].ToString().Trim();
                    node2.ImageIndex = 2;
                    node2.Tag = this.table.Rows[index][0].ToString().Trim();
                    if (this.dTable.Rows[0][4].ToString().Trim().Contains("普通用户"))
                    {
                        this.dt = this.listDB.Show_BudgetListBy_DesStyle(this.userId, this.table.Rows[index][1].ToString().Trim());
                    }
                    else
                    {
                        this.dt = this.listDB.Show_BudgetListBy_DesStyle(this.table.Rows[index][1].ToString().Trim());
                    }
                    for (num3 = 0; num3 < this.dt.Rows.Count; num3++)
                    {
                        node3 = new TreeNode();
                        node3.Text = this.dt.Rows[num3][12].ToString().Trim();
                        node3.ImageIndex = 5;
                        node3.Tag = this.dt.Rows[num3][1].ToString().Trim();
                        node2.Nodes.Insert(index, node3);
                    }
                    node4.Nodes.Add(node2);
                    node4.Expand();
                }
                node4.ImageIndex = 0;
                this.treeView1.Nodes.Add(node4);
                TreeNode node5 = new TreeNode();
                node5.Text = "按签约状态分类";
                this.table = this.barDB.Show_BudgetBargain();
                TreeNode node6 = new TreeNode();
                node6.Text = "已签约";
                node6.ImageIndex = 3;
                node5.Nodes.Add(node6);
                TreeNode node7 = new TreeNode();
                node7.Text = "未签约";
                node7.ImageIndex = 3;
                node5.Nodes.Add(node7);
                System.Data.DataTable table = null;
                for (index = 0; index < this.table.Rows.Count; index++)
                {
                    node2 = new TreeNode();
                    if (this.dTable.Rows[0][4].ToString().Trim().Contains("普通用户"))
                    {
                        table = this.listDB.Show_BudgetListBy_BudlistId(this.userId, this.table.Rows[index][1].ToString().Trim());
                    }
                    else
                    {
                        table = this.listDB.Show_BudgetListBy_BudlistId(this.table.Rows[index][1].ToString().Trim());
                    }
                    if (table.Rows.Count > 0)
                    {
                        node2.Text = table.Rows[0][12].ToString().Trim();
                        node2.ImageIndex = 5;
                        node2.Tag = this.table.Rows[index][1].ToString().Trim();
                        if (int.Parse(this.table.Rows[index][4].ToString().Trim()) == 1)
                        {
                            node6.Nodes.Insert(index, node2);
                        }
                        else
                        {
                            node7.Nodes.Insert(index, node2);
                        }
                    }
                }
                node5.ImageIndex = 0;
                node5.Expand();
                this.treeView1.Nodes.Add(node5);
            }
            catch (Exception)
            {
            }
        }

        public void autoExportExcel(DataGridView dgv)
        {
            int num = 1;
            this.tgdvTest.Nodes[0].Expand();
            for (int i = 0; i < this.tgdvTest.Nodes[0].Nodes.Count; i++)
            {
                num++;
                if (this.tgdvTest.Nodes[0].Nodes[i].HasChildren)
                {
                    this.tgdvTest.Nodes[0].Nodes[i].Expand();
                    num += this.tgdvTest.Nodes[0].Nodes[i].Nodes.Count;
                }
            }
            string filename = "";
            bool flag = false;
            SaveFileDialog dialog = new SaveFileDialog();
            dialog.DefaultExt = "xls";
            dialog.Filter = "预算文件|*.xls";
            dialog.FileName = "Sheet1";
            filename = AppDomain.CurrentDomain.BaseDirectory.ToString() + @"NewBudgetBackup\" + this.save_budget[1] + "_" + this.save_budget[2] + ".xls";
            this.tgdvTest.Nodes[0].Cells[5].Value = this.lbl_HuXing.Text.Trim();
            this.tgdvTest.Nodes[0].Cells[1].Value = this.lblCustomer.Text.Trim();
            if (filename.IndexOf(":") >= 0)
            {
                Excel.Application application = new ApplicationClass();
                if (application == null)
                {
                    MessageBox.Show("无法创建Excel对象，可能您的计算机未安装Excel ！");
                }
                else
                {
                    Excel.Range range;
                    Workbook workbook = application.Workbooks.Add(XlWBATemplate.xlWBATWorksheet);
                    Worksheet worksheet = (Worksheet) workbook.Worksheets[1];
                    long count = dgv.Rows.Count;
                    long num4 = 0L;
                    float num5 = 0f;
                    int num6 = 0;
                    while (num6 < dgv.Columns.Count)
                    {
                        worksheet.Cells[1, num6 + 1] = dgv.Columns[num6].HeaderText;
                        range = (Excel.Range) worksheet.Cells[1, num6 + 1];
                        range.Interior.ColorIndex = 15;
                        range.Font.Bold = true;
                        num6++;
                    }
                    for (int j = 0; j < dgv.Rows.Count; j++)
                    {
                        for (num6 = 0; num6 < dgv.Columns.Count; num6++)
                        {
                            worksheet.Cells[j + 2, num6 + 1] = dgv.Rows[j].Cells[num6].Value;
                        }
                        num4 += 1L;
                        num5 = ((float) (100L * num4)) / ((float) count);
                    }
                    worksheet.Cells[2, 2] = this.lblCustomer.Text.Trim();
                    range = worksheet.get_Range(worksheet.Cells[2, 1], worksheet.Cells[dgv.Rows.Count + 2, dgv.Columns.Count]);
                    range.BorderAround(XlLineStyle.xlContinuous, XlBorderWeight.xlThin, XlColorIndex.xlColorIndexAutomatic, null);
                    range.Borders[XlBordersIndex.xlInsideHorizontal].ColorIndex = XlColorIndex.xlColorIndexAutomatic;
                    range.Borders[XlBordersIndex.xlInsideHorizontal].LineStyle = XlLineStyle.xlContinuous;
                    range.Borders[XlBordersIndex.xlInsideHorizontal].Weight = XlBorderWeight.xlThin;
                    if (dgv.Columns.Count > 1)
                    {
                        range.Borders[XlBordersIndex.xlInsideVertical].ColorIndex = XlColorIndex.xlColorIndexAutomatic;
                        range.Borders[XlBordersIndex.xlInsideVertical].LineStyle = XlLineStyle.xlContinuous;
                        range.Borders[XlBordersIndex.xlInsideVertical].Weight = XlBorderWeight.xlThin;
                    }
                    if (filename != "")
                    {
                        try
                        {
                            workbook.Saved = true;
                            workbook.SaveCopyAs(filename);
                            flag = true;
                        }
                        catch (Exception)
                        {
                            flag = false;
                            MessageBox.Show("导出文件时出错,文件可能正被打开！");
                        }
                    }
                    else
                    {
                        flag = false;
                    }
                    this.tgdvTest.Nodes[0].Cells[5].Value = "";
                    application.Quit();
                    GC.Collect();
                }
            }
        }

        public void autoExportExcel1(DataGridView dgv)
        {
            int num = 1;
            this.tgdvTest.Nodes[0].Expand();
            for (int i = 0; i < this.tgdvTest.Nodes[0].Nodes.Count; i++)
            {
                num++;
                if (this.tgdvTest.Nodes[0].Nodes[i].HasChildren)
                {
                    this.tgdvTest.Nodes[0].Nodes[i].Expand();
                    num += this.tgdvTest.Nodes[0].Nodes[i].Nodes.Count;
                }
            }
            string filename = "";
            bool flag = false;
            SaveFileDialog dialog = new SaveFileDialog();
            dialog.DefaultExt = "xls";
            dialog.Filter = "预算文件|*.xls";
            dialog.FileName = "Sheet1";
            filename = AppDomain.CurrentDomain.BaseDirectory.ToString() + string.Format(@"NewBudgetBackup\{0}_{1}.xls", this.userId, this.save_budget[2]);
            this.tgdvTest.Nodes[0].Cells[5].Value = this.lbl_HuXing.Text.Trim();
            this.tgdvTest.Nodes[0].Cells[1].Value = this.lblCustomer.Text.Trim();
            if (filename.IndexOf(":") >= 0)
            {
                Excel.Application application = new ApplicationClass();
                if (application == null)
                {
                    MessageBox.Show("无法创建Excel对象，可能您的计算机未安装Excel ！");
                }
                else
                {
                    Excel.Range range;
                    Workbook workbook = application.Workbooks.Add(XlWBATemplate.xlWBATWorksheet);
                    Worksheet worksheet = (Worksheet) workbook.Worksheets[1];
                    long count = dgv.Rows.Count;
                    long num4 = 0L;
                    float num5 = 0f;
                    int num6 = 0;
                    while (num6 < dgv.Columns.Count)
                    {
                        worksheet.Cells[1, num6 + 1] = dgv.Columns[num6].HeaderText;
                        range = (Excel.Range) worksheet.Cells[1, num6 + 1];
                        range.Interior.ColorIndex = 15;
                        range.Font.Bold = true;
                        num6++;
                    }
                    for (int j = 0; j < dgv.Rows.Count; j++)
                    {
                        for (num6 = 0; num6 < dgv.Columns.Count; num6++)
                        {
                            worksheet.Cells[j + 2, num6 + 1] = dgv.Rows[j].Cells[num6].Value;
                        }
                        num4 += 1L;
                        num5 = ((float) (100L * num4)) / ((float) count);
                    }
                    worksheet.Cells[2, 2] = this.lblCustomer.Text.Trim();
                    range = worksheet.get_Range(worksheet.Cells[2, 1], worksheet.Cells[dgv.Rows.Count + 2, dgv.Columns.Count]);
                    range.BorderAround(XlLineStyle.xlContinuous, XlBorderWeight.xlThin, XlColorIndex.xlColorIndexAutomatic, null);
                    range.Borders[XlBordersIndex.xlInsideHorizontal].ColorIndex = XlColorIndex.xlColorIndexAutomatic;
                    range.Borders[XlBordersIndex.xlInsideHorizontal].LineStyle = XlLineStyle.xlContinuous;
                    range.Borders[XlBordersIndex.xlInsideHorizontal].Weight = XlBorderWeight.xlThin;
                    if (dgv.Columns.Count > 1)
                    {
                        range.Borders[XlBordersIndex.xlInsideVertical].ColorIndex = XlColorIndex.xlColorIndexAutomatic;
                        range.Borders[XlBordersIndex.xlInsideVertical].LineStyle = XlLineStyle.xlContinuous;
                        range.Borders[XlBordersIndex.xlInsideVertical].Weight = XlBorderWeight.xlThin;
                    }
                    if (filename != "")
                    {
                        try
                        {
                            workbook.Saved = true;
                            workbook.SaveCopyAs(filename);
                            flag = true;
                        }
                        catch (Exception)
                        {
                            flag = false;
                            MessageBox.Show("导出文件时出错,文件可能正被打开！");
                        }
                    }
                    else
                    {
                        flag = false;
                    }
                    this.tgdvTest.Nodes[0].Cells[5].Value = "";
                    application.Quit();
                    GC.Collect();
                }
            }
        }

        private void btn_DaoChu_Click(object sender, EventArgs e)
        {
            if (MessageBox.Show("确定要将数据导出吗？", "提示", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
            {
                this.ExportExcel(this.tgdvTest);
            }
        }

        private void btn_Delete_Budget_Click(object sender, EventArgs e)
        {
            try
            {
                if (this.lbl_address.Text.Equals(""))
                {
                    MessageBox.Show("请选择要删除的工程！", "提示", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
                }
                else if (this.treeView1.SelectedNode.Level == 2)
                {
                    if (MessageBox.Show("确定要删除吗？", "确认", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
                    {
                        if (this.treeView1.SelectedNode.Tag.ToString().Trim().Equals(""))
                        {
                            MessageBox.Show("请选择要删除的工程！", "提示", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
                        }
                        else
                        {
                            this.detailsDB.Delete_BudgetDetails(this.treeView1.SelectedNode.Tag.ToString().Trim());
                            this.infoDB.Delete_BudgetInfoBYBudgetList_Key(this.treeView1.SelectedNode.Tag.ToString().Trim());
                            this.barDB.Delete_BudgetBargainBy_budListKey(this.treeView1.SelectedNode.Tag.ToString().Trim());
                            this.listDB.Delete_BudgetList(this.treeView1.SelectedNode.Tag.ToString().Trim());
                            this.treeView1.Nodes.Clear();
                            this.add_menu();
                        }
                    }
                }
                else
                {
                    MessageBox.Show("请选择要删除的工程！", "提示", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
                }
            }
            catch (Exception)
            {
            }
        }

        private void btn_Mater_Click(object sender, EventArgs e)
        {
            if (this.txtNewBudgetTitle.Text.Trim().Equals(""))
            {
                this.txtNewBudgetTitle.Text = "            ";
            }
            this.printDocumentBill.PrintPage += new PrintPageEventHandler(this.printDocumentBill_PrintPage);
            this.pageSetupDialogBill.Document = this.printDocumentBill;
            this.printPreviewDialogBill.Document = this.printDocumentBill;
            this.printPreviewDialogBill.Width = 700;
            this.printPreviewDialogBill.Height = 800;
            this.printPreviewDialogBill.ShowDialog();
            this.printDocumentBill.DefaultPageSettings.PaperSize = new PaperSize("A4", 800, 900);
            this.printPreviewDialogBill.ClientSize = new Size(800, 700);
            this.printPreviewDialogBill.PrintPreviewControl.Zoom = 1.0;
        }

        private void btn_New_budget_Click(object sender, EventArgs e)
        {
            this.tclHNM.TabPages.Remove(this.tbpItemInfo);
            this.tclHNM.TabPages.Add(this.tbpHouseType);
            this.Text = "选择户型";
        }

        private void btn_Print_Click(object sender, EventArgs e)
        {
            try
            {
                if (this.txtNewBudgetTitle.Text.Trim().Equals(""))
                {
                    this.txtNewBudgetTitle.Text = " ";
                }
                this.dataGridView1.Rows.Clear();
                int num = 0;
                this.dataGridView1.AllowUserToResizeRows = true;
                this.dataGridView1.DefaultCellStyle.WrapMode = DataGridViewTriState.True;
                this.dataGridView1.AutoSizeRowsMode = DataGridViewAutoSizeRowsMode.AllCellsExceptHeaders;
                for (int i = 0; i < this.tgdvTest.Nodes[0].Nodes.Count; i++)
                {
                    object[] objArray = new object[] { string.Concat(new object[] { "", i + 1, "、", this.tgdvTest.Nodes[0].Nodes[i].Cells[0].Value.ToString() }), "", "", "", "", "" };
                    this.dataGridView1.Rows.Add(objArray);
                    this.dataGridView1.Rows[num].Cells[0].Style.Alignment = DataGridViewContentAlignment.MiddleLeft;
                    this.dataGridView1.Rows[num].DefaultCellStyle.BackColor = Color.LightGray;
                    num++;
                    for (int j = 0; j <= this.tgdvTest.Nodes[0].Nodes[i].Nodes.Count; j++)
                    {
                        object[] objArray2;
                        if (j == this.tgdvTest.Nodes[0].Nodes[i].Nodes.Count)
                        {
                            objArray2 = new object[] { "", "", "", "", "小计", this.tgdvTest.Nodes[0].Nodes[i].Cells[4].Value.ToString() };
                            this.dataGridView1.Rows.Add(objArray2);
                            num++;
                        }
                        else
                        {
                            objArray2 = new object[] { string.Concat(new object[] { "(", j + 1, ")", this.tgdvTest.Nodes[0].Nodes[i].Nodes[j].Cells[0].Value.ToString() }), this.tgdvTest.Nodes[0].Nodes[i].Nodes[j].Cells[5].Value.ToString(), this.tgdvTest.Nodes[0].Nodes[i].Nodes[j].Cells[3].Value.ToString(), this.tgdvTest.Nodes[0].Nodes[i].Nodes[j].Cells[1].Value.ToString(), this.tgdvTest.Nodes[0].Nodes[i].Nodes[j].Cells[2].Value.ToString(), this.tgdvTest.Nodes[0].Nodes[i].Nodes[j].Cells[4].Value.ToString() };
                            this.dataGridView1.Rows.Add(objArray2);
                            this.dataGridView1.Rows[num].Cells[0].Style.Alignment = DataGridViewContentAlignment.MiddleLeft;
                            this.dataGridView1.Rows[num].Cells[1].Style.Alignment = DataGridViewContentAlignment.MiddleLeft;
                            this.dataGridView1.Rows[num].Height = this.tgdvTest.Nodes[0].Nodes[i].Nodes[j].Height + 50;
                            num++;
                        }
                    }
                }
                object[] values = new object[] { "", "", "", "", "总计", this.tgdvTest.Nodes[0].Cells[4].Value.ToString() };
                this.dataGridView1.Rows.Add(values);
                this.dataGridView1.Rows[num].Cells[0].Style.Alignment = DataGridViewContentAlignment.MiddleLeft;
                this.dataGridView1.Rows[num].DefaultCellStyle.BackColor = Color.AliceBlue;
                object[] objArray4 = new object[] { "备注", "备注：　　　　　　　　　　　　　　　　　　　　　　　　　　　　　　　                                                                                                        　　1、所有物业押金及各种形式的管理款项敬请您承担，我方承担因施工违反物业规定而扣出的部分费用。  　　　　　　　　　               　　2、施工中如有漏报项目或增加项目，则按实际施工项目结算工程款。如有计算错误则按实际发生量为准。                                            　　　　　　　　　　　　3、以上项目都不含五金件。　　　　　　　　　　　　　　　　　　　　　　　　　　　　　　　　　　　　　　　　　　　　　　　　4、如需要对暖气片后刷乳胶漆的，须先进行拆除，刷完后安装，并收取60元/组，如不刷暖气后面面积的乳胶漆，结算时减除此面积的乳胶漆的工程量。                                                                                                                                                                                                5、所有施工项目的工程量以竣工后实际测量为准。　　　　　　　　　　　　　　　　　　　　　　　　　　　　　　　　　　　　　　　　　　　　　　　　6、乳胶漆标准为三色(含白色),如超出三色,加收150元/色。　　　　　　　　　　　　　　　　　　　　　　　　　　　　　　　　　　　　　　　　　　　　　　　　7、水电路在中期时按实际发生量结算。电路施工单价：明走管20元/米；砖墙暗走管25元/米；混凝土暗走管35元/米；线盒10元/个，ppr暗走管90元/米。　　　　　　　　　　　　　　　　　　　　　　　　　　　　　　　　　　　　　　　　　　　　　　　　　　　　　　　　8、以上所有成品部分因需现场测量，及确定样式、花色等原因，可能和基本施工项目不能同时完工，敬请谅解。　　　　　　　　　　　　　　　　　　　　　　　　　　　　　　　　　　　　　　　　　　　　　　9、本报价不含税金。　　　　　　　　　　　　　　　　　　　　　　　　　　　　　　　　　　　　　　　　　　　　　　　　　　　　　　　　　　　　　10、本报价最终解释权归济南万泰装饰建筑工程有限公司所有。", "", "", "", "" };
                this.dataGridView1.Rows.Add(objArray4);
                new PrintDGV().Print_DataGridView(this.dataGridView1, this.txtNewBudgetTitle.Text.Trim(), "客户姓名：" + this.lblCustomerName.Text.Trim(), "联系电话：" + this.lblCustomerPhone.Text.Trim(), "设计师：" + this.lbl_designer.Text.Trim(), "地址：" + this.lblProAddress.Text.Trim());
            }
            catch (Exception exception)
            {
                MessageBox.Show(exception.Message + "打印异常3");
            }
        }

        private void btn_QueDing_Click(object sender, EventArgs e)
        {
            TreeGridNode node2;
            int num13;
            budget_id = "";
            this.save_budget[0] = "";
            this.save_budget[1] = "";
            this.save_budget[2] = "";
            this.save_budget[3] = "";
            this.save_budget[4] = "";
            this.save_budget[5] = "";
            this.tclHNM.TabPages.Remove(this.tbpHouseType);
            this.tclHNM.TabPages.Add(this.tbpNewBudget);
            this.tgdvTest.Nodes.Clear();
            this.Text = "新预算";
            int num = int.Parse(this.txt_shi.Text.Trim());
            int num2 = int.Parse(this.txt_ting.Text.Trim());
            int num3 = int.Parse(this.txt_wei.Text.Trim());
            int num4 = int.Parse(this.txt_yangtai.Text.Trim());
            int num5 = int.Parse(this.txt_chufang.Text.Trim());
            int num6 = int.Parse(this.txt_guodao.Text.Trim());
            int num7 = int.Parse(this.txt_chuwujian.Text.Trim());
            int num8 = int.Parse(this.txt_xuanguan.Text.Trim());
            int num9 = int.Parse(this.txt_louti.Text.Trim());
            int num10 = int.Parse(this.txt_shuidian.Text.Trim());
            int num11 = int.Parse(this.txt_qita.Text.Trim());
            this.lbl_HuXing.Text = string.Concat(new object[] { num, "室", num2, "厅", num3, "卫" });
            int num12 = 0;
            System.Drawing.Font font = new System.Drawing.Font(this.tgdvTest.DefaultCellStyle.Font, FontStyle.Bold);
            TreeGridNode node = this.tgdvTest.Nodes.Add(new object[] { "总计", "", "", "", "0.00", "", "" });
            node.ImageIndex = 1;
            node.DefaultCellStyle.Font = font;
            node.Cells[4].Style.ForeColor = Color.Red;
            node.Cells[0].Style.BackColor = Color.Gray;
            node.Cells[1].Style.BackColor = Color.Gray;
            node.Cells[2].Style.BackColor = Color.Gray;
            node.Cells[3].Style.BackColor = Color.Gray;
            node.Cells[4].Style.BackColor = Color.Gray;
            node.Cells[5].Style.BackColor = Color.Gray;
            node.Cells[6].Style.BackColor = Color.Gray;
            if (num2 != 0)
            {
                if (num2 == 1)
                {
                    node2 = node.Nodes.Add(new object[] { "客厅", "", "", "", "0.00", "", num12 });
                    node2.ImageIndex = 2;
                    node2.Cells[4].Style.ForeColor = Color.Blue;
                    num12++;
                    node2.Cells[0].Style.BackColor = Color.LightGray;
                    node2.Cells[1].Style.BackColor = Color.LightGray;
                    node2.Cells[2].Style.BackColor = Color.LightGray;
                    node2.Cells[3].Style.BackColor = Color.LightGray;
                    node2.Cells[4].Style.BackColor = Color.LightGray;
                    node2.Cells[5].Style.BackColor = Color.LightGray;
                    node2.Cells[6].Style.BackColor = Color.LightGray;
                }
                else
                {
                    for (num13 = 1; num13 <= num2; num13++)
                    {
                        node2 = node.Nodes.Add(new object[] { "客厅" + num13, "", "", "", "0.00", "", num12 });
                        node2.ImageIndex = 2;
                        node2.Cells[4].Style.ForeColor = Color.Blue;
                        num12++;
                        node2.Cells[0].Style.BackColor = Color.LightGray;
                        node2.Cells[1].Style.BackColor = Color.LightGray;
                        node2.Cells[2].Style.BackColor = Color.LightGray;
                        node2.Cells[3].Style.BackColor = Color.LightGray;
                        node2.Cells[4].Style.BackColor = Color.LightGray;
                        node2.Cells[5].Style.BackColor = Color.LightGray;
                        node2.Cells[6].Style.BackColor = Color.LightGray;
                    }
                }
            }
            if (num8 != 0)
            {
                if (num8 == 1)
                {
                    node2 = node.Nodes.Add(new object[] { "玄关", "", "", "", "0.00", "", num12 });
                    node2.ImageIndex = 2;
                    node2.Cells[4].Style.ForeColor = Color.Blue;
                    num12++;
                    node2.Cells[0].Style.BackColor = Color.LightGray;
                    node2.Cells[1].Style.BackColor = Color.LightGray;
                    node2.Cells[2].Style.BackColor = Color.LightGray;
                    node2.Cells[3].Style.BackColor = Color.LightGray;
                    node2.Cells[4].Style.BackColor = Color.LightGray;
                    node2.Cells[5].Style.BackColor = Color.LightGray;
                    node2.Cells[6].Style.BackColor = Color.LightGray;
                }
                else
                {
                    for (num13 = 1; num13 <= num8; num13++)
                    {
                        node2 = node.Nodes.Add(new object[] { "玄关" + num13, "", "", "", "0.00", "", num12 });
                        node2.ImageIndex = 2;
                        node2.Cells[4].Style.ForeColor = Color.Blue;
                        num12++;
                        node2.Cells[0].Style.BackColor = Color.LightGray;
                        node2.Cells[1].Style.BackColor = Color.LightGray;
                        node2.Cells[2].Style.BackColor = Color.LightGray;
                        node2.Cells[3].Style.BackColor = Color.LightGray;
                        node2.Cells[4].Style.BackColor = Color.LightGray;
                        node2.Cells[5].Style.BackColor = Color.LightGray;
                        node2.Cells[6].Style.BackColor = Color.LightGray;
                    }
                }
            }
            if (num7 != 0)
            {
                if (num7 == 1)
                {
                    node2 = node.Nodes.Add(new object[] { "储物间", "", "", "", "0.00", "", num12 });
                    node2.ImageIndex = 2;
                    node2.Cells[4].Style.ForeColor = Color.Blue;
                    num12++;
                    node2.Cells[0].Style.BackColor = Color.LightGray;
                    node2.Cells[1].Style.BackColor = Color.LightGray;
                    node2.Cells[2].Style.BackColor = Color.LightGray;
                    node2.Cells[3].Style.BackColor = Color.LightGray;
                    node2.Cells[4].Style.BackColor = Color.LightGray;
                    node2.Cells[5].Style.BackColor = Color.LightGray;
                    node2.Cells[6].Style.BackColor = Color.LightGray;
                }
                else
                {
                    for (num13 = 1; num13 <= num7; num13++)
                    {
                        node2 = node.Nodes.Add(new object[] { "储物间" + num13, "", "", "", "0.00", "", num12 });
                        node2.ImageIndex = 2;
                        node2.Cells[4].Style.ForeColor = Color.Blue;
                        num12++;
                        node2.Cells[0].Style.BackColor = Color.LightGray;
                        node2.Cells[1].Style.BackColor = Color.LightGray;
                        node2.Cells[2].Style.BackColor = Color.LightGray;
                        node2.Cells[3].Style.BackColor = Color.LightGray;
                        node2.Cells[4].Style.BackColor = Color.LightGray;
                        node2.Cells[5].Style.BackColor = Color.LightGray;
                        node2.Cells[6].Style.BackColor = Color.LightGray;
                    }
                }
            }
            if (num6 != 0)
            {
                if (num6 == 1)
                {
                    node2 = node.Nodes.Add(new object[] { "过道", "", "", "", "0.00", "", num12 });
                    node2.ImageIndex = 2;
                    node2.Cells[4].Style.ForeColor = Color.Blue;
                    num12++;
                    node2.Cells[0].Style.BackColor = Color.LightGray;
                    node2.Cells[1].Style.BackColor = Color.LightGray;
                    node2.Cells[2].Style.BackColor = Color.LightGray;
                    node2.Cells[3].Style.BackColor = Color.LightGray;
                    node2.Cells[4].Style.BackColor = Color.LightGray;
                    node2.Cells[5].Style.BackColor = Color.LightGray;
                    node2.Cells[6].Style.BackColor = Color.LightGray;
                }
                else
                {
                    for (num13 = 1; num13 <= num6; num13++)
                    {
                        node2 = node.Nodes.Add(new object[] { "过道" + num13, "", "", "", "0.00", "", num12 });
                        node2.ImageIndex = 2;
                        node2.Cells[4].Style.ForeColor = Color.Blue;
                        num12++;
                        node2.Cells[0].Style.BackColor = Color.LightGray;
                        node2.Cells[1].Style.BackColor = Color.LightGray;
                        node2.Cells[2].Style.BackColor = Color.LightGray;
                        node2.Cells[3].Style.BackColor = Color.LightGray;
                        node2.Cells[4].Style.BackColor = Color.LightGray;
                        node2.Cells[5].Style.BackColor = Color.LightGray;
                        node2.Cells[6].Style.BackColor = Color.LightGray;
                    }
                }
            }
            if (num9 != 0)
            {
                if (num9 == 1)
                {
                    node2 = node.Nodes.Add(new object[] { "楼梯", "", "", "", "0.00", "", num12 });
                    node2.ImageIndex = 2;
                    node2.Cells[4].Style.ForeColor = Color.Blue;
                    num12++;
                    node2.Cells[0].Style.BackColor = Color.LightGray;
                    node2.Cells[1].Style.BackColor = Color.LightGray;
                    node2.Cells[2].Style.BackColor = Color.LightGray;
                    node2.Cells[3].Style.BackColor = Color.LightGray;
                    node2.Cells[4].Style.BackColor = Color.LightGray;
                    node2.Cells[5].Style.BackColor = Color.LightGray;
                    node2.Cells[6].Style.BackColor = Color.LightGray;
                }
                else
                {
                    for (num13 = 1; num13 <= num9; num13++)
                    {
                        node2 = node.Nodes.Add(new object[] { "楼梯" + num13, "", "", "", "0.00", "", num12 });
                        node2.ImageIndex = 2;
                        node2.Cells[4].Style.ForeColor = Color.Blue;
                        num12++;
                        node2.Cells[0].Style.BackColor = Color.LightGray;
                        node2.Cells[1].Style.BackColor = Color.LightGray;
                        node2.Cells[2].Style.BackColor = Color.LightGray;
                        node2.Cells[3].Style.BackColor = Color.LightGray;
                        node2.Cells[4].Style.BackColor = Color.LightGray;
                        node2.Cells[5].Style.BackColor = Color.LightGray;
                        node2.Cells[6].Style.BackColor = Color.LightGray;
                    }
                }
            }
            if (num != 0)
            {
                if (num == 1)
                {
                    node2 = node.Nodes.Add(new object[] { "卧室", "", "", "", "0.00", "", num12 });
                    node2.ImageIndex = 2;
                    node2.Cells[4].Style.ForeColor = Color.Blue;
                    num12++;
                    node2.Cells[0].Style.BackColor = Color.LightGray;
                    node2.Cells[1].Style.BackColor = Color.LightGray;
                    node2.Cells[2].Style.BackColor = Color.LightGray;
                    node2.Cells[3].Style.BackColor = Color.LightGray;
                    node2.Cells[4].Style.BackColor = Color.LightGray;
                    node2.Cells[5].Style.BackColor = Color.LightGray;
                    node2.Cells[6].Style.BackColor = Color.LightGray;
                }
                else
                {
                    for (num13 = 1; num13 <= num; num13++)
                    {
                        node2 = node.Nodes.Add(new object[] { "卧室" + num13, "", "", "", "0.00", "", num12 });
                        node2.ImageIndex = 2;
                        node2.Cells[4].Style.ForeColor = Color.Blue;
                        num12++;
                        node2.Cells[0].Style.BackColor = Color.LightGray;
                        node2.Cells[1].Style.BackColor = Color.LightGray;
                        node2.Cells[2].Style.BackColor = Color.LightGray;
                        node2.Cells[3].Style.BackColor = Color.LightGray;
                        node2.Cells[4].Style.BackColor = Color.LightGray;
                        node2.Cells[5].Style.BackColor = Color.LightGray;
                        node2.Cells[6].Style.BackColor = Color.LightGray;
                    }
                }
            }
            if (num3 != 0)
            {
                if (num3 == 1)
                {
                    node2 = node.Nodes.Add(new object[] { "卫生间", "", "", "", "0.00", "", num12 });
                    node2.ImageIndex = 2;
                    node2.Cells[4].Style.ForeColor = Color.Blue;
                    num12++;
                    node2.Cells[0].Style.BackColor = Color.LightGray;
                    node2.Cells[1].Style.BackColor = Color.LightGray;
                    node2.Cells[2].Style.BackColor = Color.LightGray;
                    node2.Cells[3].Style.BackColor = Color.LightGray;
                    node2.Cells[4].Style.BackColor = Color.LightGray;
                    node2.Cells[5].Style.BackColor = Color.LightGray;
                    node2.Cells[6].Style.BackColor = Color.LightGray;
                }
                else
                {
                    for (num13 = 1; num13 <= num3; num13++)
                    {
                        node2 = node.Nodes.Add(new object[] { "卫生间" + num13, "", "", "", "0.00", "", num12 });
                        node2.ImageIndex = 2;
                        node2.Cells[4].Style.ForeColor = Color.Blue;
                        num12++;
                        node2.Cells[0].Style.BackColor = Color.LightGray;
                        node2.Cells[1].Style.BackColor = Color.LightGray;
                        node2.Cells[2].Style.BackColor = Color.LightGray;
                        node2.Cells[3].Style.BackColor = Color.LightGray;
                        node2.Cells[4].Style.BackColor = Color.LightGray;
                        node2.Cells[5].Style.BackColor = Color.LightGray;
                        node2.Cells[6].Style.BackColor = Color.LightGray;
                    }
                }
            }
            if (num5 != 0)
            {
                if (num5 == 1)
                {
                    node2 = node.Nodes.Add(new object[] { "厨房", "", "", "", "0.00", "", num12 });
                    node2.ImageIndex = 2;
                    node2.Cells[4].Style.ForeColor = Color.Blue;
                    num12++;
                    node2.Cells[0].Style.BackColor = Color.LightGray;
                    node2.Cells[1].Style.BackColor = Color.LightGray;
                    node2.Cells[2].Style.BackColor = Color.LightGray;
                    node2.Cells[3].Style.BackColor = Color.LightGray;
                    node2.Cells[4].Style.BackColor = Color.LightGray;
                    node2.Cells[5].Style.BackColor = Color.LightGray;
                    node2.Cells[6].Style.BackColor = Color.LightGray;
                }
                else
                {
                    for (num13 = 1; num13 <= num5; num13++)
                    {
                        node2 = node.Nodes.Add(new object[] { "厨房" + num13, "", "", "", "0.00", "", num12 });
                        node2.ImageIndex = 2;
                        node2.Cells[4].Style.ForeColor = Color.Blue;
                        num12++;
                        node2.Cells[0].Style.BackColor = Color.LightGray;
                        node2.Cells[1].Style.BackColor = Color.LightGray;
                        node2.Cells[2].Style.BackColor = Color.LightGray;
                        node2.Cells[3].Style.BackColor = Color.LightGray;
                        node2.Cells[4].Style.BackColor = Color.LightGray;
                        node2.Cells[5].Style.BackColor = Color.LightGray;
                        node2.Cells[6].Style.BackColor = Color.LightGray;
                    }
                }
            }
            if (num4 != 0)
            {
                if (num4 == 1)
                {
                    node2 = node.Nodes.Add(new object[] { "阳台", "", "", "", "0.00", "", num12 });
                    node2.ImageIndex = 2;
                    node2.Cells[4].Style.ForeColor = Color.Blue;
                    num12++;
                    node2.Cells[0].Style.BackColor = Color.LightGray;
                    node2.Cells[1].Style.BackColor = Color.LightGray;
                    node2.Cells[2].Style.BackColor = Color.LightGray;
                    node2.Cells[3].Style.BackColor = Color.LightGray;
                    node2.Cells[4].Style.BackColor = Color.LightGray;
                    node2.Cells[5].Style.BackColor = Color.LightGray;
                    node2.Cells[6].Style.BackColor = Color.LightGray;
                }
                else
                {
                    for (num13 = 1; num13 <= num4; num13++)
                    {
                        node2 = node.Nodes.Add(new object[] { "阳台" + num13, "", "", "", "0.00", "", num12 });
                        node2.ImageIndex = 2;
                        node2.Cells[4].Style.ForeColor = Color.Blue;
                        num12++;
                        node2.Cells[0].Style.BackColor = Color.LightGray;
                        node2.Cells[1].Style.BackColor = Color.LightGray;
                        node2.Cells[2].Style.BackColor = Color.LightGray;
                        node2.Cells[3].Style.BackColor = Color.LightGray;
                        node2.Cells[4].Style.BackColor = Color.LightGray;
                        node2.Cells[5].Style.BackColor = Color.LightGray;
                        node2.Cells[6].Style.BackColor = Color.LightGray;
                    }
                }
            }
            if (num10 != 0)
            {
                if (num10 == 1)
                {
                    node2 = node.Nodes.Add(new object[] { "水电", "", "", "", "0.00", "", num12 });
                    node2.ImageIndex = 2;
                    node2.Cells[4].Style.ForeColor = Color.Blue;
                    num12++;
                    node2.Cells[0].Style.BackColor = Color.LightGray;
                    node2.Cells[1].Style.BackColor = Color.LightGray;
                    node2.Cells[2].Style.BackColor = Color.LightGray;
                    node2.Cells[3].Style.BackColor = Color.LightGray;
                    node2.Cells[4].Style.BackColor = Color.LightGray;
                    node2.Cells[5].Style.BackColor = Color.LightGray;
                    node2.Cells[6].Style.BackColor = Color.LightGray;
                }
                else
                {
                    for (num13 = 1; num13 <= num10; num13++)
                    {
                        node2 = node.Nodes.Add(new object[] { "水电" + num13, "", "", "", "0.00", "", num12 });
                        node2.ImageIndex = 2;
                        node2.Cells[4].Style.ForeColor = Color.Blue;
                        num12++;
                        node2.Cells[0].Style.BackColor = Color.LightGray;
                        node2.Cells[1].Style.BackColor = Color.LightGray;
                        node2.Cells[2].Style.BackColor = Color.LightGray;
                        node2.Cells[3].Style.BackColor = Color.LightGray;
                        node2.Cells[4].Style.BackColor = Color.LightGray;
                        node2.Cells[5].Style.BackColor = Color.LightGray;
                        node2.Cells[6].Style.BackColor = Color.LightGray;
                    }
                }
            }
            if (num11 != 0)
            {
                if (num11 == 1)
                {
                    node2 = node.Nodes.Add(new object[] { "其他", "", "", "", "0.00", "", num12 });
                    node2.ImageIndex = 2;
                    node2.Cells[4].Style.ForeColor = Color.Blue;
                    num12++;
                    node2.Cells[0].Style.BackColor = Color.LightGray;
                    node2.Cells[1].Style.BackColor = Color.LightGray;
                    node2.Cells[2].Style.BackColor = Color.LightGray;
                    node2.Cells[3].Style.BackColor = Color.LightGray;
                    node2.Cells[4].Style.BackColor = Color.LightGray;
                    node2.Cells[5].Style.BackColor = Color.LightGray;
                    node2.Cells[6].Style.BackColor = Color.LightGray;
                }
                else
                {
                    for (num13 = 1; num13 <= num11; num13++)
                    {
                        node2 = node.Nodes.Add(new object[] { "其他" + num13, "", "", "", "0.00", "", num12 });
                        node2.ImageIndex = 2;
                        node2.Cells[4].Style.ForeColor = Color.Blue;
                        node2.Cells[0].Style.BackColor = Color.LightGray;
                        node2.Cells[1].Style.BackColor = Color.LightGray;
                        node2.Cells[2].Style.BackColor = Color.LightGray;
                        node2.Cells[3].Style.BackColor = Color.LightGray;
                        node2.Cells[4].Style.BackColor = Color.LightGray;
                        node2.Cells[5].Style.BackColor = Color.LightGray;
                        node2.Cells[6].Style.BackColor = Color.LightGray;
                        num12++;
                    }
                }
            }
            node.Expand();
            this.s = this.tgdvTest.Nodes[0].Nodes.Count;
        }

        private void btn_QuXiao_Click(object sender, EventArgs e)
        {
            try
            {
                base.Dispose();
            }
            catch (Exception)
            {
            }
        }

        private void btn_Save_Click(object sender, EventArgs e)
        {
            if (this.tgdvTest.Nodes.Count != 0)
            {
                this.btn_Save.Enabled = true;
                this.SaveNewBudget();
            }
        }

        private void btn_SheJiTu_mingxi_Click(object sender, EventArgs e)
        {
            if (this.lbl_address.Text.Equals(""))
            {
                MessageBox.Show(this, "请选择要查看设计图的工程！", "提示", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
            }
            else if (this.treeView1.SelectedNode.Level == 2)
            {
                new FormPicture(this.treeView1.SelectedNode.Tag.ToString().Trim()).ShowDialog();
            }
            else
            {
                MessageBox.Show(this, "请选择要查看设计图的工程！", "提示", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
            }
        }

        private void btn_YuSuan_mingxi_Click(object sender, EventArgs e)
        {
            if (this.lbl_address.Text.Equals(""))
            {
                MessageBox.Show(this, "请选择要查看明细的工程！", "提示", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
            }
            else if (this.treeView1.SelectedNode.Level == 2)
            {
                this.tclHNM.TabPages.Remove(this.tbpItemInfo);
                this.tclHNM.TabPages.Add(this.tbpNewBudget);
                this.Text = "新预算";
                budget_id = this.treeView1.SelectedNode.Tag.ToString().Trim();
                this.tgv_Bind(this.treeView1.SelectedNode.Tag.ToString().Trim());
                this.lblCustomer.Text = this.lblCustomerName.Text.Trim();
                this.tgdvTest.Nodes[0].Expand();
                for (int i = 0; i < this.tgdvTest.Nodes[0].Nodes.Count; i++)
                {
                    this.tgdvTest.Nodes[0].Nodes[i].Expand();
                }
            }
            else
            {
                MessageBox.Show(this, "请选择要查看明细的工程！", "提示", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
            }
        }

        private void btnCopyBudget_Click(object sender, EventArgs e)
        {
            try
            {
                if (this.lbl_address.Text.Equals(""))
                {
                    MessageBox.Show(this, "请选择要复制的工程！", "提示", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
                }
                else if (this.treeView1.SelectedNode.Level == 2)
                {
                    jzgl.Windows.BudgetInfo info = new jzgl.Windows.BudgetInfo(this.treeView1.SelectedNode.Tag.ToString().Trim(), this.lbl_housetype.Text.Trim(), this.userId);
                    info.Owner = this;
                    info.ShowDialog();
                    info.StartPosition = FormStartPosition.CenterParent;
                    if (this.SaveNewBudget1())
                    {
                        this.c = 0;
                        this.treeView1.Nodes.Clear();
                        this.add_menu();
                    }
                    else
                    {
                        MessageBox.Show("操作失败！");
                    }
                }
                else
                {
                    MessageBox.Show(this, "请选择要复制的工程！", "提示", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
                }
            }
            catch (Exception)
            {
                MessageBox.Show(this, "请选择要复制的工程！", "提示", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
            }
        }

        private void btnHidden_Click(object sender, EventArgs e)
        {
            this.splitContainer1.Panel1Collapsed = false;
            this.splitContainer1.Panel2Collapsed = true;
        }

        public void ComboBox_bind()
        {
            try
            {
                this.table = this.typeDB.Show_MaterType();
                DataRow row = this.table.NewRow();
                row[0] = 0;
                row[1] = "所有类";
                this.table.Rows.InsertAt(row, 0);
                this.comboBox_MaterType.DataSource = this.table;
                this.comboBox_MaterType.DisplayMember = "MaterTypeName";
                this.comboBox_MaterType.ValueMember = "MaterTypeId";
            }
            catch (Exception)
            {
            }
        }

        private void comboBox_MaterType_SelectedIndexChanged(object sender, EventArgs e)
        {
            if (this.comboBox_MaterType.Text.Equals("所有类"))
            {
                this.Data_bind();
            }
            else
            {
                this.Data_bind(this.comboBox_MaterType.SelectedValue.ToString().Trim());
            }
        }

        private void contextMenuStrip1_Opening(object sender, CancelEventArgs e)
        {
            if (this.tgdvTest.CurrentNode.Level == 3)
            {
                this.contextMenuStrip1.Enabled = true;
                this.选择施工项目ToolStripMenuItem.Enabled = false;
                this.修改单元格名称ToolStripMenuItem.Enabled = false;
                this.附加项目ToolStripMenuItem.Enabled = false;
                this.添加施工单元ToolStripMenuItem.Enabled = false;
                this.删除施工单元ToolStripMenuItem.Text = "删除施工物料";
                this.复制单元项目ToolStripMenuItem.Text = "复制施工物料";
                this.粘贴单元项目ToolStripMenuItem.Text = "粘贴施工物料";
            }
            else if (this.tgdvTest.CurrentNode.Level == 1)
            {
                this.contextMenuStrip1.Enabled = false;
            }
            else
            {
                this.contextMenuStrip1.Enabled = true;
                this.选择施工项目ToolStripMenuItem.Enabled = true;
                this.修改单元格名称ToolStripMenuItem.Enabled = true;
                this.附加项目ToolStripMenuItem.Enabled = true;
                this.复制单元项目ToolStripMenuItem.Enabled = true;
                this.粘贴单元项目ToolStripMenuItem.Enabled = true;
                this.添加施工单元ToolStripMenuItem.Enabled = true;
                this.删除施工单元ToolStripMenuItem.Text = "删除施工单元";
                this.复制单元项目ToolStripMenuItem.Text = "复制单元项目";
                this.粘贴单元项目ToolStripMenuItem.Text = "粘贴单元项目";
            }
        }

        public void Data_bind()
        {
            try
            {
                this.dataGridView2.Rows.Clear();
                this.table = this.materDB.Show_MaterInfo();
                if (this.table != null)
                {
                    for (int i = 0; i < this.table.Rows.Count; i++)
                    {
                        object[] values = new object[] { this.table.Rows[i][1].ToString(), this.table.Rows[i][2].ToString(), double.Parse(this.table.Rows[i][3].ToString()).ToString("f2"), this.table.Rows[i][4].ToString() };
                        this.dataGridView2.Rows.Add(values);
                        if ((i % 2) == 0)
                        {
                            this.dataGridView2.Rows[i].DefaultCellStyle.BackColor = Color.LightGray;
                        }
                    }
                }
            }
            catch (Exception)
            {
            }
        }

        public void Data_bind(string type_id)
        {
            try
            {
                this.dataGridView2.Rows.Clear();
                this.table = this.materDB.Show_MaterInfo(type_id);
                if (this.table != null)
                {
                    for (int i = 0; i < this.table.Rows.Count; i++)
                    {
                        object[] values = new object[] { this.table.Rows[i][1].ToString(), this.table.Rows[i][2].ToString(), double.Parse(this.table.Rows[i][3].ToString()).ToString("f2"), this.table.Rows[i][4].ToString() };
                        this.dataGridView2.Rows.Add(values);
                        if ((i % 2) == 0)
                        {
                            this.dataGridView2.Rows[i].DefaultCellStyle.BackColor = Color.LightGray;
                        }
                    }
                }
            }
            catch (Exception)
            {
            }
        }

        private void dataGridView2_CellContentClick(object sender, DataGridViewCellEventArgs e)
        {
        }

        private void dataGridView2_CellDoubleClick(object sender, DataGridViewCellEventArgs e)
        {
            if ((this.tgdvTest.CurrentNode.Level == 2) && (this.dataGridView2.Rows.Count > 0))
            {
                System.Drawing.Font font = new System.Drawing.Font(this.tgdvTest.DefaultCellStyle.Font, FontStyle.Bold);
                TreeGridNode node = this.tgdvTest.CurrentNode.Nodes.Add(new object[] { this.dataGridView2.CurrentRow.Cells[0].Value.ToString(), this.dataGridView2.CurrentRow.Cells[1].Value.ToString(), this.dataGridView2.CurrentRow.Cells[2].Value.ToString(), "0.00", "0.00", this.dataGridView2.CurrentRow.Cells[3].Value.ToString(), "" });
                node.ImageIndex = 0;
                node.Tag = "";
                this.tgdvTest.CurrentNode.Expand();
                node.Cells[0].ReadOnly = true;
                node.Cells[1].ReadOnly = true;
                node.Cells[2].ReadOnly = true;
                node.Cells[5].ReadOnly = true;
            }
        }

        private void DataGridViewToExcel(TreeGridView dgv)
        {
            string str = DateTime.Now.ToString("yyyyMMddHHmmss");
            SaveFileDialog dialog = new SaveFileDialog();
            dialog.Filter = "files (*.xls)|*.xls";
            dialog.FilterIndex = 0;
            dialog.RestoreDirectory = true;
            dialog.CreatePrompt = true;
            dialog.Title = "保存为obf文件";
            dialog.InitialDirectory = AppDomain.CurrentDomain.BaseDirectory.ToString() + @"NewBudget\";
            dialog.FileName = str;
            int num = 1;
            this.tgdvTest.Nodes[0].Expand();
            for (int i = 0; i < this.tgdvTest.Nodes[0].Nodes.Count; i++)
            {
                num++;
                if (this.tgdvTest.Nodes[0].Nodes[i].HasChildren)
                {
                    this.tgdvTest.Nodes[0].Nodes[i].Expand();
                    num += this.tgdvTest.Nodes[0].Nodes[i].Nodes.Count;
                }
            }
            if (dialog.ShowDialog() == DialogResult.OK)
            {
                Stream stream = dialog.OpenFile();
                StreamWriter writer = new StreamWriter(stream, Encoding.GetEncoding(0));
                string str2 = "";
                try
                {
                    for (int j = 0; j < dgv.ColumnCount; j++)
                    {
                        if (j > 0)
                        {
                            str2 = str2 + "\t";
                        }
                        str2 = str2 + dgv.Columns[j].HeaderText;
                    }
                    writer.WriteLine(str2);
                    for (int k = 0; k < dgv.Rows.Count; k++)
                    {
                        string str3 = "";
                        for (int m = 0; m < dgv.Columns.Count; m++)
                        {
                            if (m > 0)
                            {
                                str3 = str3 + "\t";
                            }
                            if (dgv.Rows[k].Cells[m].Value == null)
                            {
                                str3 = str3 + "";
                            }
                            else
                            {
                                str3 = str3 + dgv.Rows[k].Cells[m].Value.ToString().Trim();
                            }
                        }
                        writer.WriteLine(str3);
                    }
                    writer.Close();
                    stream.Close();
                }
                catch (Exception exception)
                {
                    MessageBox.Show(exception.ToString());
                }
                finally
                {
                    writer.Close();
                    stream.Close();
                }
            }
        }

        protected override void Dispose(bool disposing)
        {
            if (disposing && (this.components != null))
            {
                this.components.Dispose();
            }
            base.Dispose(disposing);
        }

        public bool ExportDataGridview(DataGridView dgv, TreeGridView gridView, bool isShowExcle)
        {
            int num4;
            int num = 1;
            this.tgdvTest.Nodes[0].Expand();
            for (int i = 0; i < this.tgdvTest.Nodes[0].Nodes.Count; i++)
            {
                num++;
                if (this.tgdvTest.Nodes[0].Nodes[i].HasChildren)
                {
                    this.tgdvTest.Nodes[0].Nodes[i].Expand();
                    num += this.tgdvTest.Nodes[0].Nodes[i].Nodes.Count;
                }
            }
            if (gridView.Rows.Count == 0)
            {
                return false;
            }
            Excel.Application application = new ApplicationClass();
            application.Application.Workbooks.Add(true);
            application.Visible = isShowExcle;
            application.DefaultFilePath = AppDomain.CurrentDomain.BaseDirectory.ToString();
            for (num4 = 0; num4 < gridView.ColumnCount; num4++)
            {
                application.Cells[1, num4 + 1] = gridView.Columns[num4].HeaderText;
            }
            for (num4 = 1; num4 < num; num4++)
            {
                for (int j = 0; j < gridView.ColumnCount; j++)
                {
                    if (gridView[j, num4].ValueType == typeof(string))
                    {
                        application.Cells[num4 + 2, j + 1] = "'" + gridView[j, num4].Value.ToString();
                    }
                    else
                    {
                        application.Cells[num4 + 2, j + 1] = gridView[j, num4].Value.ToString();
                    }
                }
            }
            return true;
        }

        public void ExportExcel(DataGridView dgv)
        {
            int num = 1;
            this.tgdvTest.Nodes[0].Expand();
            for (int i = 0; i < this.tgdvTest.Nodes[0].Nodes.Count; i++)
            {
                num++;
                if (this.tgdvTest.Nodes[0].Nodes[i].HasChildren)
                {
                    this.tgdvTest.Nodes[0].Nodes[i].Expand();
                    num += this.tgdvTest.Nodes[0].Nodes[i].Nodes.Count;
                }
            }
            string filename = "";
            bool flag = false;
            SaveFileDialog dialog = new SaveFileDialog();
            dialog.DefaultExt = "xls";
            dialog.Filter = "预算文件|*.xls";
            string str2 = AppDomain.CurrentDomain.BaseDirectory.ToString() + @"NewBudget\";
            dialog.InitialDirectory = str2;
            dialog.FileName = "Sheet1";
            dialog.ShowDialog();
            filename = dialog.FileName;
            this.tgdvTest.Nodes[0].Cells[5].Value = this.lbl_HuXing.Text.Trim();
            if (filename.IndexOf(":") < 0)
            {
                this.tgdvTest.Nodes[0].Cells[5].Value = "";
            }
            else
            {
                Excel.Application application = new ApplicationClass();
                if (application == null)
                {
                    MessageBox.Show("无法创建Excel对象，可能您的计算机未安装Excel");
                }
                else
                {
                    Excel.Range range;
                    Workbook workbook = application.Workbooks.Add(XlWBATemplate.xlWBATWorksheet);
                    Worksheet worksheet = (Worksheet) workbook.Worksheets[1];
                    long count = dgv.Rows.Count;
                    long num4 = 0L;
                    float num5 = 0f;
                    int num6 = 0;
                    while (num6 < dgv.Columns.Count)
                    {
                        worksheet.Cells[1, num6 + 1] = dgv.Columns[num6].HeaderText;
                        range = (Excel.Range) worksheet.Cells[1, num6 + 1];
                        range.Interior.ColorIndex = 15;
                        range.Font.Bold = true;
                        num6++;
                    }
                    for (int j = 0; j < dgv.Rows.Count; j++)
                    {
                        for (num6 = 0; num6 < dgv.Columns.Count; num6++)
                        {
                            worksheet.Cells[j + 2, num6 + 1] = dgv.Rows[j].Cells[num6].Value;
                        }
                        num4 += 1L;
                        num5 = ((float) (100L * num4)) / ((float) count);
                    }
                    worksheet.Cells[2, 2] = this.lblCustomer.Text.Trim();
                    range = worksheet.get_Range(worksheet.Cells[2, 1], worksheet.Cells[dgv.Rows.Count + 2, dgv.Columns.Count]);
                    range.BorderAround(XlLineStyle.xlContinuous, XlBorderWeight.xlThin, XlColorIndex.xlColorIndexAutomatic, null);
                    range.Borders[XlBordersIndex.xlInsideHorizontal].ColorIndex = XlColorIndex.xlColorIndexAutomatic;
                    range.Borders[XlBordersIndex.xlInsideHorizontal].LineStyle = XlLineStyle.xlContinuous;
                    range.Borders[XlBordersIndex.xlInsideHorizontal].Weight = XlBorderWeight.xlThin;
                    if (dgv.Columns.Count > 1)
                    {
                        range.Borders[XlBordersIndex.xlInsideVertical].ColorIndex = XlColorIndex.xlColorIndexAutomatic;
                        range.Borders[XlBordersIndex.xlInsideVertical].LineStyle = XlLineStyle.xlContinuous;
                        range.Borders[XlBordersIndex.xlInsideVertical].Weight = XlBorderWeight.xlThin;
                    }
                    if (filename != "")
                    {
                        try
                        {
                            workbook.Saved = true;
                            workbook.SaveCopyAs(filename);
                            flag = true;
                        }
                        catch (Exception exception)
                        {
                            flag = false;
                            MessageBox.Show("导出文件时出错,文件可能正被打开！\n" + exception.Message);
                        }
                    }
                    else
                    {
                        flag = false;
                        this.tgdvTest.Nodes[0].Cells[5].Value = "";
                    }
                    this.tgdvTest.Nodes[0].Cells[5].Value = "";
                    application.Quit();
                    GC.Collect();
                }
            }
        }

        private List<BudgetDetails> GetBudgetDetailsNodes()
        {
            List<BudgetDetails> list = new List<BudgetDetails>();
            try
            {
                for (int i = 0; i < this.tgdvTest.Nodes[0].Nodes.Count; i++)
                {
                    if (this.tgdvTest.Nodes[0].Nodes[i].Nodes.Count > 0)
                    {
                        for (int j = 0; j < this.tgdvTest.Nodes[0].Nodes[i].Nodes.Count; j++)
                        {
                            BudgetDetails item = new BudgetDetails();
                            item.BudInfoNodeId = this.tgdvTest.Nodes[0].Nodes[i].Index;
                            item.ParentBudName = this.tgdvTest.Nodes[0].Nodes[i].Cells[0].Value.ToString();
                            item._BudDetName = this.tgdvTest.Nodes[0].Nodes[i].Nodes[j].Cells[0].Value.ToString();
                            item._BudDetUnit = this.tgdvTest.Nodes[0].Nodes[i].Nodes[j].Cells[1].Value.ToString();
                            item._BudDetPrice = float.Parse(this.tgdvTest.Nodes[0].Nodes[i].Nodes[j].Cells[2].Value.ToString());
                            item._BudDetNum = float.Parse(this.tgdvTest.Nodes[0].Nodes[i].Nodes[j].Cells[3].Value.ToString());
                            item._BudDetSum = float.Parse(this.tgdvTest.Nodes[0].Nodes[i].Nodes[j].Cells[4].Value.ToString());
                            item._BudDetTech = this.tgdvTest.Nodes[0].Nodes[i].Nodes[j].Cells[5].Value.ToString();
                            item._BudDetRemark = this.tgdvTest.Nodes[0].Nodes[i].Nodes[j].Tag.ToString().Trim();
                            list.Add(item);
                        }
                    }
                }
            }
            catch (Exception)
            {
                MessageBox.Show(this, "请确保预算数据正确！", "提示", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
            }
            return list;
        }

        private List<jzgl.Model.BudgetInfo> GetItemNodes()
        {
            List<jzgl.Model.BudgetInfo> list = new List<jzgl.Model.BudgetInfo>();
            try
            {
                for (int i = 0; i < this.tgdvTest.Nodes[0].Nodes.Count; i++)
                {
                    jzgl.Model.BudgetInfo item = new jzgl.Model.BudgetInfo();
                    item.BudInfoNodeId = this.tgdvTest.Nodes[0].Nodes[i].Index;
                    item._BudInfoName = this.tgdvTest.Nodes[0].Nodes[i].Cells[0].Value.ToString();
                    item._BudInfoPrice = float.Parse(this.tgdvTest.Nodes[0].Nodes[i].Cells[4].Value.ToString());
                    list.Add(item);
                }
            }
            catch (Exception)
            {
                MessageBox.Show(this, "请确保预算数据正确！", "提示", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
            }
            return list;
        }

        private void HouseTypeInfo_FormClosing(object sender, FormClosingEventArgs e)
        {
            if (this.tclHNM.SelectedTab.Text.Trim().Contains("新预算"))
            {
                if (MessageBox.Show("确定要关闭 [ 新预算 ] 窗口吗？", "提示", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.No)
                {
                    e.Cancel = true;
                    this.table = null;
                    this.dTable = null;
                    this.c = 1;
                    this.h = "";
                    this.item_money = 0f;
                    this.total_money = 0f;
                    this.dt = null;
                    budget_id = "";
                    mouseState = 0;
                    this.materList = null;
                    this.userId = "";
                    this.er = 0;
                    this.er2 = 0;
                    this.san = 0;
                    this.er_a = 0;
                    this.fj_index = "";
                    this.fj = 0;
                    this.bz = 0;
                    this.fj_copy_index = -1;
                }
                else
                {
                    base.Dispose();
                }
            }
        }

        private void HouseTypeInfo_Load(object sender, EventArgs e)
        {
            this.tgdvTest.DefaultCellStyle.WrapMode = DataGridViewTriState.True;
            this.tgdvTest.AutoSizeRowsMode = DataGridViewAutoSizeRowsMode.AllCellsExceptHeaders;
            this.imageStrip.ImageSize = new Size(0x10, 0x10);
            this.imageStrip.TransparentColor = Color.Magenta;
            this.imageStrip.ImageSize = new Size(0x10, 0x10);
            this.tgdvTest.ImageList = this.imageStrip;
            this.dataGridView1.Rows.Clear();
            this.splitContainer1.Panel1Collapsed = false;
            this.splitContainer1.Panel2Collapsed = true;
            this.copy[0] = "";
            this.copy[1] = "";
            this.copy[2] = "";
            this.copy[3] = "";
            this.copy[4] = "";
            this.copy[5] = "";
            this.copy[6] = "";
            this.copy[7] = "";
        }

        public bool importNewBudget()
        {
            System.Drawing.Font font = new System.Drawing.Font(this.tgdvTest.DefaultCellStyle.Font, FontStyle.Bold);
            bool flag = false;
            this.openFileDialog1.Filter = "预算文件|*.xls";
            this.openFileDialog1.FilterIndex = 0;
            this.openFileDialog1.RestoreDirectory = true;
            this.openFileDialog1.Title = "导入新预算";
            string str = AppDomain.CurrentDomain.BaseDirectory.ToString() + @"NewBudgetBackup\";
            this.openFileDialog1.InitialDirectory = str;
            if (this.openFileDialog1.ShowDialog() == DialogResult.OK)
            {
                string fileName = this.openFileDialog1.FileName;
                if (fileName.IndexOf(":") < 0)
                {
                    flag = false;
                }
                string str3 = fileName.Substring(fileName.LastIndexOf(".")).ToString().Trim();
                string str4 = fileName.Substring(fileName.LastIndexOf(@"\")).ToString().Trim();
                string filename = str4.Substring(1, str4.IndexOf(".") - 1);
                if ((str3 != ".xls") && (str3 != ".xlsx"))
                {
                    MessageBox.Show("文件格式不正确！");
                    return flag;
                }
                DataSet set = null;
                set = ConnDB.ExcelToDSBy_FileName(this.openFileDialog1.FileName, filename);
                if (set != null)
                {
                    if (set.Tables[0].Rows.Count > 0)
                    {
                        System.Data.DataTable table = set.Tables[0];
                        if (table.Columns.Count < 6)
                        {
                            return flag;
                        }
                        TreeGridNode node = new TreeGridNode();
                        TreeGridNode node2 = new TreeGridNode();
                        int num2 = 0;
                        this.lbl_HuXing.Text = table.Rows[1][5].ToString().Trim();
                        budget_id = table.Rows[1][6].ToString().Trim();
                        TreeGridNode node3 = this.tgdvTest.Nodes.Add(new object[] { "总计", "", "", "", double.Parse(table.Rows[1][4].ToString().Trim()).ToString("f2"), "", table.Rows[1][6].ToString().Trim() });
                        budget_id = table.Rows[1][6].ToString().Trim();
                        this.lblCustomer.Text = table.Rows[1][1].ToString().Trim();
                        if (table.Rows[1][4].ToString().Trim().Equals(""))
                        {
                            this.lbl_HuXing.Text = table.Rows[1][5].ToString().Trim();
                        }
                        node3.ImageIndex = 1;
                        node3.DefaultCellStyle.Font = font;
                        node3.Cells[4].Style.ForeColor = Color.Red;
                        node3.Cells[0].Style.BackColor = Color.Gray;
                        node3.Cells[1].Style.BackColor = Color.Gray;
                        node3.Cells[2].Style.BackColor = Color.Gray;
                        node3.Cells[3].Style.BackColor = Color.Gray;
                        node3.Cells[4].Style.BackColor = Color.Gray;
                        node3.Cells[5].Style.BackColor = Color.Gray;
                        node3.Cells[6].Style.BackColor = Color.Gray;
                        for (int i = 2; i < (table.Rows.Count - 1); i++)
                        {
                            if (!table.Rows[i][6].ToString().Trim().Equals(""))
                            {
                                node = node3.Nodes.Add(new object[] { table.Rows[i][0].ToString().Trim(), "", "", "", double.Parse(table.Rows[i][4].ToString().Trim()).ToString("f2"), "", num2 });
                                node.ImageIndex = 2;
                                node.Cells[4].Style.ForeColor = Color.Blue;
                                node.Cells[0].Style.BackColor = Color.LightGray;
                                node.Cells[1].Style.BackColor = Color.LightGray;
                                node.Cells[2].Style.BackColor = Color.LightGray;
                                node.Cells[3].Style.BackColor = Color.LightGray;
                                node.Cells[4].Style.BackColor = Color.LightGray;
                                node.Cells[5].Style.BackColor = Color.LightGray;
                                node.Cells[6].Style.BackColor = Color.LightGray;
                                num2++;
                            }
                            else
                            {
                                try
                                {
                                    node2 = node.Nodes.Add(new object[] { table.Rows[i][0].ToString().Trim(), table.Rows[i][1].ToString().Trim(), double.Parse(table.Rows[i][2].ToString().Trim()).ToString("f2"), double.Parse(table.Rows[i][3].ToString().Trim()).ToString("f2"), double.Parse(table.Rows[i][4].ToString().Trim()).ToString("f2"), table.Rows[i][5].ToString().Trim(), "" });
                                    node2.ImageIndex = 0;
                                    node2.Tag = "";
                                    num2++;
                                }
                                catch (Exception exception)
                                {
                                    MessageBox.Show(exception.Message);
                                }
                            }
                        }
                        this.tgdvTest.Nodes[0].Expand();
                        flag = true;
                        this.table = this.listDB.Show_BudgetListBy_BudlistId(budget_id);
                        if (this.table.Rows.Count > 0)
                        {
                            this.lblCustomerName.Text = this.table.Rows[0][2].ToString();
                            this.lblCustomerPhone.Text = this.table.Rows[0][3].ToString();
                            this.lbl_designer.Text = this.table.Rows[0][4].ToString();
                            this.lblProAddress.Text = this.table.Rows[0][12].ToString();
                        }
                    }
                    return flag;
                }
                MessageBox.Show("导入失败，请检查：\n数据源是否为空 \n数据源格式是否正确 \n文件名是否修改");
                return flag;
            }
            return false;
        }

        private void InitializeComponent()
        {
            this.components = new Container();
            DataGridViewCellStyle style = new DataGridViewCellStyle();
            DataGridViewCellStyle style2 = new DataGridViewCellStyle();
            DataGridViewCellStyle style3 = new DataGridViewCellStyle();
            DataGridViewCellStyle style4 = new DataGridViewCellStyle();
            DataGridViewCellStyle style5 = new DataGridViewCellStyle();
            DataGridViewCellStyle style6 = new DataGridViewCellStyle();
            DataGridViewCellStyle style7 = new DataGridViewCellStyle();
            DataGridViewCellStyle style8 = new DataGridViewCellStyle();
            DataGridViewCellStyle style9 = new DataGridViewCellStyle();
            DataGridViewCellStyle style10 = new DataGridViewCellStyle();
            DataGridViewCellStyle style11 = new DataGridViewCellStyle();
            ComponentResourceManager manager = new ComponentResourceManager(typeof(HouseTypeInfo));
            DataGridViewCellStyle style12 = new DataGridViewCellStyle();
            DataGridViewCellStyle style13 = new DataGridViewCellStyle();
            DataGridViewCellStyle style14 = new DataGridViewCellStyle();
            DataGridViewCellStyle style15 = new DataGridViewCellStyle();
            DataGridViewCellStyle style16 = new DataGridViewCellStyle();
            DataGridViewCellStyle style17 = new DataGridViewCellStyle();
            DataGridViewCellStyle style18 = new DataGridViewCellStyle();
            DataGridViewCellStyle style19 = new DataGridViewCellStyle();
            this.panel3 = new Panel();
            this.dataGridView1 = new DataGridView();
            this.Column2 = new DataGridViewTextBoxColumn();
            this.Column3 = new DataGridViewTextBoxColumn();
            this.Column6 = new DataGridViewTextBoxColumn();
            this.Column4 = new DataGridViewTextBoxColumn();
            this.Column5 = new DataGridViewTextBoxColumn();
            this.Column7 = new DataGridViewTextBoxColumn();
            this.btn_DaoChu = new System.Windows.Forms.Button();
            this.btn_Save = new System.Windows.Forms.Button();
            this.btn_Print = new System.Windows.Forms.Button();
            this.btn_Mater = new System.Windows.Forms.Button();
            this.tgdvTest = new TreeGridView();
            this.clmItem = new TreeGridColumn();
            this.clmUnit = new DataGridViewTextBoxColumn();
            this.clmUnitPrice = new DataGridViewTextBoxColumn();
            this.clmNum = new DataGridViewTextBoxColumn();
            this.clmTotalAmount = new DataGridViewTextBoxColumn();
            this.clmAboutRead = new DataGridViewTextBoxColumn();
            this.clmId = new DataGridViewTextBoxColumn();
            this.contextMenuStrip1 = new ContextMenuStrip(this.components);
            this.修改单元格名称ToolStripMenuItem = new ToolStripMenuItem();
            this.选择施工项目ToolStripMenuItem = new ToolStripMenuItem();
            this.附加项目ToolStripMenuItem = new ToolStripMenuItem();
            this.复制单元项目ToolStripMenuItem = new ToolStripMenuItem();
            this.粘贴单元项目ToolStripMenuItem = new ToolStripMenuItem();
            this.添加施工单元ToolStripMenuItem = new ToolStripMenuItem();
            this.删除施工单元ToolStripMenuItem = new ToolStripMenuItem();
            this.imageStrip = new ImageList(this.components);
            this.pnlNewBudTop = new Panel();
            this.txtNewBudgetTitle = new System.Windows.Forms.TextBox();
            this.label29 = new System.Windows.Forms.Label();
            this.lblCustomer = new System.Windows.Forms.Label();
            this.lbl_HuXing = new System.Windows.Forms.Label();
            this.label12 = new System.Windows.Forms.Label();
            this.label13 = new System.Windows.Forms.Label();
            this.pnlSelectHouse = new Panel();
            this.btn_QueDing = new System.Windows.Forms.Button();
            this.groupBox1 = new System.Windows.Forms.GroupBox();
            this.txt_qita = new System.Windows.Forms.TextBox();
            this.txt_shuidian = new System.Windows.Forms.TextBox();
            this.txt_louti = new System.Windows.Forms.TextBox();
            this.txt_xuanguan = new System.Windows.Forms.TextBox();
            this.txt_chuwujian = new System.Windows.Forms.TextBox();
            this.txt_guodao = new System.Windows.Forms.TextBox();
            this.txt_chufang = new System.Windows.Forms.TextBox();
            this.txt_yangtai = new System.Windows.Forms.TextBox();
            this.txt_wei = new System.Windows.Forms.TextBox();
            this.txt_ting = new System.Windows.Forms.TextBox();
            this.txt_shi = new System.Windows.Forms.TextBox();
            this.label11 = new System.Windows.Forms.Label();
            this.label10 = new System.Windows.Forms.Label();
            this.label9 = new System.Windows.Forms.Label();
            this.label8 = new System.Windows.Forms.Label();
            this.label7 = new System.Windows.Forms.Label();
            this.label6 = new System.Windows.Forms.Label();
            this.label5 = new System.Windows.Forms.Label();
            this.label4 = new System.Windows.Forms.Label();
            this.label3 = new System.Windows.Forms.Label();
            this.label2 = new System.Windows.Forms.Label();
            this.label1 = new System.Windows.Forms.Label();
            this.tclHNM = new TabControl();
            this.tbpHouseType = new TabPage();
            this.label34 = new System.Windows.Forms.Label();
            this.lblProAddress = new System.Windows.Forms.Label();
            this.lblDesigner = new System.Windows.Forms.Label();
            this.lblCustomerPhone = new System.Windows.Forms.Label();
            this.lblCustomerName = new System.Windows.Forms.Label();
            this.tbpItemInfo = new TabPage();
            this.panel1111 = new Panel();
            this.btn_Delete_Budget = new System.Windows.Forms.Button();
            this.btnCopyBudget = new System.Windows.Forms.Button();
            this.btn_New_budget = new System.Windows.Forms.Button();
            this.panel1 = new Panel();
            this.textBox1 = new System.Windows.Forms.TextBox();
            this.lbl_SheJiTu = new System.Windows.Forms.Label();
            this.lbl_YuSuan = new System.Windows.Forms.Label();
            this.lbl_cust_idea = new System.Windows.Forms.Label();
            this.lbl_GongChang = new System.Windows.Forms.Label();
            this.lbl_ShiGong_date = new System.Windows.Forms.Label();
            this.lbl_HeTong_price = new System.Windows.Forms.Label();
            this.lbl_style = new System.Windows.Forms.Label();
            this.lbl_Qiandan_date = new System.Windows.Forms.Label();
            this.lbl_housetype = new System.Windows.Forms.Label();
            this.lbl_address = new System.Windows.Forms.Label();
            this.lbl_area = new System.Windows.Forms.Label();
            this.lbl_phone = new System.Windows.Forms.Label();
            this.lbl_designer = new System.Windows.Forms.Label();
            this.lbl_custname = new System.Windows.Forms.Label();
            this.btn_SheJiTu_mingxi = new System.Windows.Forms.Button();
            this.btn_YuSuan_mingxi = new System.Windows.Forms.Button();
            this.label14 = new System.Windows.Forms.Label();
            this.label16 = new System.Windows.Forms.Label();
            this.label17 = new System.Windows.Forms.Label();
            this.label18 = new System.Windows.Forms.Label();
            this.label19 = new System.Windows.Forms.Label();
            this.label20 = new System.Windows.Forms.Label();
            this.label21 = new System.Windows.Forms.Label();
            this.label22 = new System.Windows.Forms.Label();
            this.label23 = new System.Windows.Forms.Label();
            this.label24 = new System.Windows.Forms.Label();
            this.label25 = new System.Windows.Forms.Label();
            this.label26 = new System.Windows.Forms.Label();
            this.label27 = new System.Windows.Forms.Label();
            this.label28 = new System.Windows.Forms.Label();
            this.treeView1 = new TreeView();
            this.imageList1 = new ImageList(this.components);
            this.tbpNewBudget = new TabPage();
            this.splitContainer1 = new SplitContainer();
            this.pnlNewBudget = new Panel();
            this.panel2 = new Panel();
            this.panel4 = new Panel();
            this.panel7 = new Panel();
            this.dataGridView2 = new DataGridView();
            this.dataGridViewTextBoxColumn7 = new DataGridViewTextBoxColumn();
            this.dataGridViewTextBoxColumn5 = new DataGridViewTextBoxColumn();
            this.dataGridViewTextBoxColumn6 = new DataGridViewTextBoxColumn();
            this.Column1 = new DataGridViewTextBoxColumn();
            this.Column8 = new DataGridViewTextBoxColumn();
            this.panel5 = new Panel();
            this.btnHidden = new System.Windows.Forms.Button();
            this.comboBox_MaterType = new ComboBox();
            this.label15 = new System.Windows.Forms.Label();
            this.printDocumentBill = new PrintDocument();
            this.printPreviewDialogBill = new PrintPreviewDialog();
            this.pageSetupDialogBill = new PageSetupDialog();
            this.openFileDialog1 = new OpenFileDialog();
            this.dataGridViewTextBoxColumn1 = new DataGridViewTextBoxColumn();
            this.dataGridViewTextBoxColumn2 = new DataGridViewTextBoxColumn();
            this.dataGridViewTextBoxColumn3 = new DataGridViewTextBoxColumn();
            this.dataGridViewTextBoxColumn4 = new DataGridViewTextBoxColumn();
            this.dataGridViewTextBoxColumn8 = new DataGridViewTextBoxColumn();
            this.dataGridViewTextBoxColumn9 = new DataGridViewTextBoxColumn();
            this.dataGridViewTextBoxColumn10 = new DataGridViewTextBoxColumn();
            this.dataGridViewTextBoxColumn11 = new DataGridViewTextBoxColumn();
            this.label30 = new System.Windows.Forms.Label();
            this.panel3.SuspendLayout();
            ((ISupportInitialize) this.dataGridView1).BeginInit();
            ((ISupportInitialize) this.tgdvTest).BeginInit();
            this.contextMenuStrip1.SuspendLayout();
            this.pnlNewBudTop.SuspendLayout();
            this.pnlSelectHouse.SuspendLayout();
            this.groupBox1.SuspendLayout();
            this.tclHNM.SuspendLayout();
            this.tbpHouseType.SuspendLayout();
            this.tbpItemInfo.SuspendLayout();
            this.panel1111.SuspendLayout();
            this.panel1.SuspendLayout();
            this.tbpNewBudget.SuspendLayout();
            this.splitContainer1.Panel1.SuspendLayout();
            this.splitContainer1.Panel2.SuspendLayout();
            this.splitContainer1.SuspendLayout();
            this.pnlNewBudget.SuspendLayout();
            this.panel2.SuspendLayout();
            this.panel4.SuspendLayout();
            this.panel7.SuspendLayout();
            ((ISupportInitialize) this.dataGridView2).BeginInit();
            this.panel5.SuspendLayout();
            base.SuspendLayout();
            this.panel3.Controls.Add(this.dataGridView1);
            this.panel3.Controls.Add(this.btn_DaoChu);
            this.panel3.Controls.Add(this.btn_Save);
            this.panel3.Controls.Add(this.btn_Print);
            this.panel3.Controls.Add(this.btn_Mater);
            this.panel3.Dock = DockStyle.Bottom;
            this.panel3.Location = new System.Drawing.Point(0, 0x1cf);
            this.panel3.Name = "panel3";
            this.panel3.Size = new Size(0x25c, 0x48);
            this.panel3.TabIndex = 3;
            this.dataGridView1.AllowUserToAddRows = false;
            this.dataGridView1.Anchor = AnchorStyles.Right | AnchorStyles.Top;
            this.dataGridView1.BorderStyle = BorderStyle.Fixed3D;
            style.Alignment = DataGridViewContentAlignment.MiddleCenter;
            style.BackColor = SystemColors.Control;
            style.Font = new System.Drawing.Font("宋体", 9f, FontStyle.Regular, GraphicsUnit.Point, 0x86);
            style.ForeColor = SystemColors.WindowText;
            style.SelectionBackColor = SystemColors.Highlight;
            style.SelectionForeColor = SystemColors.HighlightText;
            style.WrapMode = DataGridViewTriState.True;
            this.dataGridView1.ColumnHeadersDefaultCellStyle = style;
            this.dataGridView1.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.AutoSize;
            this.dataGridView1.Columns.AddRange(new DataGridViewColumn[] { this.Column2, this.Column3, this.Column6, this.Column4, this.Column5, this.Column7 });
            style2.Alignment = DataGridViewContentAlignment.MiddleCenter;
            style2.BackColor = SystemColors.Window;
            style2.Font = new System.Drawing.Font("宋体", 9f, FontStyle.Regular, GraphicsUnit.Point, 0x86);
            style2.ForeColor = SystemColors.ControlText;
            style2.SelectionBackColor = SystemColors.Highlight;
            style2.SelectionForeColor = SystemColors.HighlightText;
            style2.WrapMode = DataGridViewTriState.False;
            this.dataGridView1.DefaultCellStyle = style2;
            this.dataGridView1.Location = new System.Drawing.Point(0x233, 0x2e);
            this.dataGridView1.Name = "dataGridView1";
            this.dataGridView1.ReadOnly = true;
            style3.Alignment = DataGridViewContentAlignment.MiddleRight;
            style3.BackColor = SystemColors.Control;
            style3.Font = new System.Drawing.Font("宋体", 9f, FontStyle.Regular, GraphicsUnit.Point, 0x86);
            style3.ForeColor = SystemColors.WindowText;
            style3.SelectionBackColor = SystemColors.Highlight;
            style3.SelectionForeColor = SystemColors.HighlightText;
            style3.WrapMode = DataGridViewTriState.True;
            this.dataGridView1.RowHeadersDefaultCellStyle = style3;
            this.dataGridView1.RowHeadersVisible = false;
            this.dataGridView1.RowTemplate.Height = 40;
            this.dataGridView1.Size = new Size(0x26, 0x16);
            this.dataGridView1.TabIndex = 15;
            style4.Alignment = DataGridViewContentAlignment.MiddleCenter;
            this.Column2.DefaultCellStyle = style4;
            this.Column2.HeaderText = "项目名称";
            this.Column2.Name = "Column2";
            this.Column2.ReadOnly = true;
            this.Column2.Width = 140;
            this.Column3.HeaderText = "工艺做法";
            this.Column3.Name = "Column3";
            this.Column3.ReadOnly = true;
            this.Column3.Width = 300;
            this.Column6.HeaderText = "数量";
            this.Column6.Name = "Column6";
            this.Column6.ReadOnly = true;
            this.Column6.Width = 0x41;
            this.Column4.HeaderText = "单位";
            this.Column4.Name = "Column4";
            this.Column4.ReadOnly = true;
            this.Column4.Width = 60;
            this.Column5.HeaderText = "单价";
            this.Column5.Name = "Column5";
            this.Column5.ReadOnly = true;
            this.Column5.Width = 70;
            this.Column7.HeaderText = "合价";
            this.Column7.Name = "Column7";
            this.Column7.ReadOnly = true;
            this.Column7.Width = 70;
            this.btn_DaoChu.Location = new System.Drawing.Point(170, 30);
            this.btn_DaoChu.Name = "btn_DaoChu";
            this.btn_DaoChu.Size = new Size(0x4b, 0x17);
            this.btn_DaoChu.TabIndex = 10;
            this.btn_DaoChu.Text = "导出(&E)";
            this.btn_DaoChu.UseVisualStyleBackColor = true;
            this.btn_DaoChu.Click += new EventHandler(this.btn_DaoChu_Click);
            this.btn_Save.Location = new System.Drawing.Point(0x4a, 30);
            this.btn_Save.Name = "btn_Save";
            this.btn_Save.Size = new Size(0x4b, 0x17);
            this.btn_Save.TabIndex = 9;
            this.btn_Save.Text = "保存(&S)";
            this.btn_Save.UseVisualStyleBackColor = true;
            this.btn_Save.Click += new EventHandler(this.btn_Save_Click);
            this.btn_Print.Location = new System.Drawing.Point(0x10f, 30);
            this.btn_Print.Name = "btn_Print";
            this.btn_Print.Size = new Size(0x4b, 0x17);
            this.btn_Print.TabIndex = 11;
            this.btn_Print.Text = "打印(&P)";
            this.btn_Print.UseVisualStyleBackColor = true;
            this.btn_Print.Click += new EventHandler(this.btn_Print_Click);
            this.btn_Mater.Location = new System.Drawing.Point(0x174, 30);
            this.btn_Mater.Name = "btn_Mater";
            this.btn_Mater.Size = new Size(90, 0x17);
            this.btn_Mater.TabIndex = 12;
            this.btn_Mater.Text = "物料清单(&L)";
            this.btn_Mater.UseVisualStyleBackColor = true;
            this.btn_Mater.Visible = false;
            this.btn_Mater.Click += new EventHandler(this.btn_Mater_Click);
            this.tgdvTest.AccessibleRole = AccessibleRole.None;
            this.tgdvTest.AllowUserToAddRows = false;
            this.tgdvTest.AllowUserToDeleteRows = false;
            this.tgdvTest.AutoSizeColumnsMode = DataGridViewAutoSizeColumnsMode.Fill;
            this.tgdvTest.AutoSizeRowsMode = DataGridViewAutoSizeRowsMode.AllHeaders;
            this.tgdvTest.BackgroundColor = Color.WhiteSmoke;
            this.tgdvTest.BorderStyle = BorderStyle.Fixed3D;
            style5.Alignment = DataGridViewContentAlignment.MiddleCenter;
            style5.BackColor = SystemColors.Control;
            style5.Font = new System.Drawing.Font("宋体", 9f, FontStyle.Regular, GraphicsUnit.Point, 0x86);
            style5.ForeColor = SystemColors.WindowText;
            style5.SelectionBackColor = SystemColors.Highlight;
            style5.SelectionForeColor = SystemColors.HighlightText;
            style5.WrapMode = DataGridViewTriState.True;
            this.tgdvTest.ColumnHeadersDefaultCellStyle = style5;
            this.tgdvTest.Columns.AddRange(new DataGridViewColumn[] { this.clmItem, this.clmUnit, this.clmUnitPrice, this.clmNum, this.clmTotalAmount, this.clmAboutRead, this.clmId });
            this.tgdvTest.ContextMenuStrip = this.contextMenuStrip1;
            style6.Alignment = DataGridViewContentAlignment.MiddleLeft;
            style6.BackColor = Color.White;
            style6.Font = new System.Drawing.Font("宋体", 9f, FontStyle.Regular, GraphicsUnit.Point, 0x86);
            style6.ForeColor = SystemColors.ControlText;
            style6.SelectionBackColor = SystemColors.Highlight;
            style6.SelectionForeColor = SystemColors.HighlightText;
            style6.WrapMode = DataGridViewTriState.False;
            this.tgdvTest.DefaultCellStyle = style6;
            this.tgdvTest.Dock = DockStyle.Fill;
            this.tgdvTest.EditMode = DataGridViewEditMode.EditOnEnter;
            this.tgdvTest.ImageList = this.imageStrip;
            this.tgdvTest.Location = new System.Drawing.Point(0, 0);
            this.tgdvTest.Name = "tgdvTest";
            style7.Alignment = DataGridViewContentAlignment.MiddleLeft;
            style7.BackColor = SystemColors.Control;
            style7.Font = new System.Drawing.Font("宋体", 9f, FontStyle.Regular, GraphicsUnit.Point, 0x86);
            style7.ForeColor = SystemColors.WindowText;
            style7.SelectionBackColor = SystemColors.Highlight;
            style7.SelectionForeColor = SystemColors.HighlightText;
            style7.WrapMode = DataGridViewTriState.True;
            this.tgdvTest.RowHeadersDefaultCellStyle = style7;
            this.tgdvTest.RowHeadersWidth = 0x1c;
            this.tgdvTest.SelectionMode = DataGridViewSelectionMode.CellSelect;
            this.tgdvTest.Size = new Size(0x25c, 0x19f);
            this.tgdvTest.TabIndex = 2;
            this.tgdvTest.MouseDown += new MouseEventHandler(this.tgdvTest_MouseDown);
            this.tgdvTest.CellDoubleClick += new DataGridViewCellEventHandler(this.tgdvTest_CellDoubleClick);
            this.tgdvTest.RowLeave += new DataGridViewCellEventHandler(this.tgdvTest_RowLeave);
            this.tgdvTest.CellEndEdit += new DataGridViewCellEventHandler(this.tgdvTest_CellEndEdit);
            this.tgdvTest.CellClick += new DataGridViewCellEventHandler(this.tgdvTest_CellClick);
            this.tgdvTest.CellContentClick += new DataGridViewCellEventHandler(this.tgdvTest_CellContentClick);
            this.clmItem.DefaultNodeImage = null;
            this.clmItem.FillWeight = 75f;
            this.clmItem.HeaderText = "项目名称";
            this.clmItem.Name = "clmItem";
            this.clmItem.ReadOnly = true;
            this.clmItem.Resizable = DataGridViewTriState.True;
            this.clmItem.SortMode = DataGridViewColumnSortMode.NotSortable;
            style8.Alignment = DataGridViewContentAlignment.MiddleCenter;
            this.clmUnit.DefaultCellStyle = style8;
            this.clmUnit.FillWeight = 25f;
            this.clmUnit.HeaderText = "单位";
            this.clmUnit.Name = "clmUnit";
            this.clmUnit.ReadOnly = true;
            this.clmUnit.Resizable = DataGridViewTriState.True;
            this.clmUnit.SortMode = DataGridViewColumnSortMode.NotSortable;
            style9.Alignment = DataGridViewContentAlignment.MiddleRight;
            style9.Format = "N2";
            style9.NullValue = null;
            this.clmUnitPrice.DefaultCellStyle = style9;
            this.clmUnitPrice.FillWeight = 30f;
            this.clmUnitPrice.HeaderText = "单价(元)";
            this.clmUnitPrice.Name = "clmUnitPrice";
            this.clmUnitPrice.ReadOnly = true;
            this.clmUnitPrice.Resizable = DataGridViewTriState.True;
            this.clmUnitPrice.SortMode = DataGridViewColumnSortMode.NotSortable;
            style10.Alignment = DataGridViewContentAlignment.MiddleRight;
            style10.Format = "N2";
            style10.NullValue = null;
            this.clmNum.DefaultCellStyle = style10;
            this.clmNum.FillWeight = 25f;
            this.clmNum.HeaderText = "数量";
            this.clmNum.Name = "clmNum";
            this.clmNum.Resizable = DataGridViewTriState.True;
            this.clmNum.SortMode = DataGridViewColumnSortMode.NotSortable;
            style11.Alignment = DataGridViewContentAlignment.MiddleRight;
            style11.Format = "N2";
            style11.NullValue = null;
            this.clmTotalAmount.DefaultCellStyle = style11;
            this.clmTotalAmount.FillWeight = 35f;
            this.clmTotalAmount.HeaderText = "合价(元)";
            this.clmTotalAmount.Name = "clmTotalAmount";
            this.clmTotalAmount.ReadOnly = true;
            this.clmTotalAmount.Resizable = DataGridViewTriState.True;
            this.clmTotalAmount.SortMode = DataGridViewColumnSortMode.NotSortable;
            this.clmAboutRead.FillWeight = 139f;
            this.clmAboutRead.HeaderText = "工艺做法";
            this.clmAboutRead.Name = "clmAboutRead";
            this.clmAboutRead.ReadOnly = true;
            this.clmAboutRead.Resizable = DataGridViewTriState.True;
            this.clmAboutRead.SortMode = DataGridViewColumnSortMode.NotSortable;
            this.clmId.HeaderText = "编号";
            this.clmId.Name = "clmId";
            this.clmId.ReadOnly = true;
            this.clmId.Resizable = DataGridViewTriState.True;
            this.clmId.SortMode = DataGridViewColumnSortMode.NotSortable;
            this.clmId.Visible = false;
            this.contextMenuStrip1.Items.AddRange(new ToolStripItem[] { this.修改单元格名称ToolStripMenuItem, this.选择施工项目ToolStripMenuItem, this.附加项目ToolStripMenuItem, this.复制单元项目ToolStripMenuItem, this.粘贴单元项目ToolStripMenuItem, this.添加施工单元ToolStripMenuItem, this.删除施工单元ToolStripMenuItem });
            this.contextMenuStrip1.Name = "contextMenuStrip1";
            this.contextMenuStrip1.Size = new Size(0x9b, 0x9e);
            this.contextMenuStrip1.Opening += new CancelEventHandler(this.contextMenuStrip1_Opening);
            this.修改单元格名称ToolStripMenuItem.Name = "修改单元格名称ToolStripMenuItem";
            this.修改单元格名称ToolStripMenuItem.Size = new Size(0x9a, 0x16);
            this.修改单元格名称ToolStripMenuItem.Text = "修改单元格名称";
            this.修改单元格名称ToolStripMenuItem.Click += new EventHandler(this.修改单元格名称ToolStripMenuItem_Click);
            this.选择施工项目ToolStripMenuItem.Name = "选择施工项目ToolStripMenuItem";
            this.选择施工项目ToolStripMenuItem.Size = new Size(0x9a, 0x16);
            this.选择施工项目ToolStripMenuItem.Text = "选择施工项目";
            this.选择施工项目ToolStripMenuItem.Click += new EventHandler(this.选择施工项目ToolStripMenuItem_Click);
            this.附加项目ToolStripMenuItem.Name = "附加项目ToolStripMenuItem";
            this.附加项目ToolStripMenuItem.Size = new Size(0x9a, 0x16);
            this.附加项目ToolStripMenuItem.Text = "附加项目";
            this.附加项目ToolStripMenuItem.Click += new EventHandler(this.附加项目ToolStripMenuItem_Click);
            this.复制单元项目ToolStripMenuItem.Name = "复制单元项目ToolStripMenuItem";
            this.复制单元项目ToolStripMenuItem.Size = new Size(0x9a, 0x16);
            this.复制单元项目ToolStripMenuItem.Text = "复制单元项目";
            this.复制单元项目ToolStripMenuItem.Click += new EventHandler(this.复制单元项目ToolStripMenuItem_Click);
            this.粘贴单元项目ToolStripMenuItem.Name = "粘贴单元项目ToolStripMenuItem";
            this.粘贴单元项目ToolStripMenuItem.Size = new Size(0x9a, 0x16);
            this.粘贴单元项目ToolStripMenuItem.Text = "粘贴单元项目";
            this.粘贴单元项目ToolStripMenuItem.Click += new EventHandler(this.粘贴单元项目ToolStripMenuItem_Click);
            this.添加施工单元ToolStripMenuItem.Name = "添加施工单元ToolStripMenuItem";
            this.添加施工单元ToolStripMenuItem.Size = new Size(0x9a, 0x16);
            this.添加施工单元ToolStripMenuItem.Text = "添加施工单元";
            this.添加施工单元ToolStripMenuItem.Click += new EventHandler(this.添加施工单元ToolStripMenuItem_Click);
            this.删除施工单元ToolStripMenuItem.Name = "删除施工单元ToolStripMenuItem";
            this.删除施工单元ToolStripMenuItem.Size = new Size(0x9a, 0x16);
            this.删除施工单元ToolStripMenuItem.Text = "删除施工单元";
            this.删除施工单元ToolStripMenuItem.Click += new EventHandler(this.删除施工单元ToolStripMenuItem_Click);
            this.imageStrip.ImageStream = (ImageListStreamer) manager.GetObject("imageStrip.ImageStream");
            this.imageStrip.TransparentColor = Color.Transparent;
            this.imageStrip.Images.SetKeyName(0, "");
            this.imageStrip.Images.SetKeyName(1, "");
            this.imageStrip.Images.SetKeyName(2, "");
            this.imageStrip.Images.SetKeyName(3, "");
            this.pnlNewBudTop.Controls.Add(this.txtNewBudgetTitle);
            this.pnlNewBudTop.Controls.Add(this.label29);
            this.pnlNewBudTop.Controls.Add(this.lblCustomer);
            this.pnlNewBudTop.Controls.Add(this.lbl_HuXing);
            this.pnlNewBudTop.Controls.Add(this.label12);
            this.pnlNewBudTop.Controls.Add(this.label13);
            this.pnlNewBudTop.Dock = DockStyle.Top;
            this.pnlNewBudTop.Location = new System.Drawing.Point(0, 0);
            this.pnlNewBudTop.Name = "pnlNewBudTop";
            this.pnlNewBudTop.Size = new Size(0x25c, 0x30);
            this.pnlNewBudTop.TabIndex = 1;
            this.txtNewBudgetTitle.Location = new System.Drawing.Point(0x1a3, 0x12);
            this.txtNewBudgetTitle.Name = "txtNewBudgetTitle";
            this.txtNewBudgetTitle.Size = new Size(0xb6, 0x15);
            this.txtNewBudgetTitle.TabIndex = 0x13;
            this.label29.AutoSize = true;
            this.label29.Location = new System.Drawing.Point(0x15a, 0x16);
            this.label29.Name = "label29";
            this.label29.Size = new Size(0x4d, 12);
            this.label29.TabIndex = 0x12;
            this.label29.Text = "预算子标题：";
            this.lblCustomer.Location = new System.Drawing.Point(0x43, 0x16);
            this.lblCustomer.Name = "lblCustomer";
            this.lblCustomer.Size = new Size(0x29, 12);
            this.lblCustomer.TabIndex = 0x11;
            this.lbl_HuXing.AutoSize = true;
            this.lbl_HuXing.Location = new System.Drawing.Point(0x103, 0x16);
            this.lbl_HuXing.Name = "lbl_HuXing";
            this.lbl_HuXing.Size = new Size(0, 12);
            this.lbl_HuXing.TabIndex = 0x10;
            this.label12.AutoSize = true;
            this.label12.Location = new System.Drawing.Point(0xcf, 0x15);
            this.label12.Name = "label12";
            this.label12.Size = new Size(0x35, 12);
            this.label12.TabIndex = 13;
            this.label12.Text = "户  型：";
            this.label13.AutoSize = true;
            this.label13.Location = new System.Drawing.Point(5, 0x16);
            this.label13.Name = "label13";
            this.label13.Size = new Size(0x41, 12);
            this.label13.TabIndex = 12;
            this.label13.Text = "客户名称：";
            this.pnlSelectHouse.BackColor = Color.Azure;
            this.pnlSelectHouse.BorderStyle = BorderStyle.Fixed3D;
            this.pnlSelectHouse.Controls.Add(this.btn_QueDing);
            this.pnlSelectHouse.Controls.Add(this.groupBox1);
            this.pnlSelectHouse.Location = new System.Drawing.Point(0x8e, 0x26);
            this.pnlSelectHouse.Name = "pnlSelectHouse";
            this.pnlSelectHouse.Size = new Size(0x1e4, 0x105);
            this.pnlSelectHouse.TabIndex = 0;
            this.btn_QueDing.Location = new System.Drawing.Point(0x189, 0xd9);
            this.btn_QueDing.Name = "btn_QueDing";
            this.btn_QueDing.Size = new Size(70, 0x17);
            this.btn_QueDing.TabIndex = 1;
            this.btn_QueDing.Text = "确定(&O)";
            this.btn_QueDing.UseVisualStyleBackColor = true;
            this.btn_QueDing.Click += new EventHandler(this.btn_QueDing_Click);
            this.groupBox1.Controls.Add(this.txt_qita);
            this.groupBox1.Controls.Add(this.txt_shuidian);
            this.groupBox1.Controls.Add(this.txt_louti);
            this.groupBox1.Controls.Add(this.txt_xuanguan);
            this.groupBox1.Controls.Add(this.txt_chuwujian);
            this.groupBox1.Controls.Add(this.txt_guodao);
            this.groupBox1.Controls.Add(this.txt_chufang);
            this.groupBox1.Controls.Add(this.txt_yangtai);
            this.groupBox1.Controls.Add(this.txt_wei);
            this.groupBox1.Controls.Add(this.txt_ting);
            this.groupBox1.Controls.Add(this.txt_shi);
            this.groupBox1.Controls.Add(this.label11);
            this.groupBox1.Controls.Add(this.label10);
            this.groupBox1.Controls.Add(this.label9);
            this.groupBox1.Controls.Add(this.label8);
            this.groupBox1.Controls.Add(this.label7);
            this.groupBox1.Controls.Add(this.label6);
            this.groupBox1.Controls.Add(this.label5);
            this.groupBox1.Controls.Add(this.label4);
            this.groupBox1.Controls.Add(this.label3);
            this.groupBox1.Controls.Add(this.label2);
            this.groupBox1.Controls.Add(this.label1);
            this.groupBox1.Location = new System.Drawing.Point(4, 3);
            this.groupBox1.Name = "groupBox1";
            this.groupBox1.Size = new Size(0x1d9, 0xc5);
            this.groupBox1.TabIndex = 0;
            this.groupBox1.TabStop = false;
            this.groupBox1.Text = "选择户型";
            this.txt_qita.Location = new System.Drawing.Point(0xbb, 0x90);
            this.txt_qita.Name = "txt_qita";
            this.txt_qita.Size = new Size(0x41, 0x15);
            this.txt_qita.TabIndex = 10;
            this.txt_qita.Text = "0";
            this.txt_qita.TextAlign = HorizontalAlignment.Right;
            this.txt_qita.KeyPress += new KeyPressEventHandler(this.txt_qita_KeyPress);
            this.txt_shuidian.Location = new System.Drawing.Point(0x40, 0x90);
            this.txt_shuidian.Name = "txt_shuidian";
            this.txt_shuidian.Size = new Size(0x41, 0x15);
            this.txt_shuidian.TabIndex = 9;
            this.txt_shuidian.Text = "0";
            this.txt_shuidian.TextAlign = HorizontalAlignment.Right;
            this.txt_shuidian.KeyPress += new KeyPressEventHandler(this.txt_shuidian_KeyPress);
            this.txt_louti.Location = new System.Drawing.Point(0x124, 0x6b);
            this.txt_louti.Name = "txt_louti";
            this.txt_louti.Size = new Size(0x41, 0x15);
            this.txt_louti.TabIndex = 8;
            this.txt_louti.Text = "0";
            this.txt_louti.TextAlign = HorizontalAlignment.Right;
            this.txt_louti.KeyPress += new KeyPressEventHandler(this.txt_louti_KeyPress);
            this.txt_xuanguan.Location = new System.Drawing.Point(0xbb, 0x6c);
            this.txt_xuanguan.Name = "txt_xuanguan";
            this.txt_xuanguan.Size = new Size(0x41, 0x15);
            this.txt_xuanguan.TabIndex = 7;
            this.txt_xuanguan.Text = "0";
            this.txt_xuanguan.TextAlign = HorizontalAlignment.Right;
            this.txt_xuanguan.KeyPress += new KeyPressEventHandler(this.txt_xuanguan_KeyPress);
            this.txt_chuwujian.Location = new System.Drawing.Point(0x40, 0x6d);
            this.txt_chuwujian.Name = "txt_chuwujian";
            this.txt_chuwujian.Size = new Size(0x41, 0x15);
            this.txt_chuwujian.TabIndex = 6;
            this.txt_chuwujian.Text = "0";
            this.txt_chuwujian.TextAlign = HorizontalAlignment.Right;
            this.txt_chuwujian.KeyPress += new KeyPressEventHandler(this.txt_chuwujian_KeyPress);
            this.txt_guodao.Location = new System.Drawing.Point(0x124, 0x47);
            this.txt_guodao.Name = "txt_guodao";
            this.txt_guodao.Size = new Size(0x41, 0x15);
            this.txt_guodao.TabIndex = 5;
            this.txt_guodao.Text = "0";
            this.txt_guodao.TextAlign = HorizontalAlignment.Right;
            this.txt_guodao.KeyPress += new KeyPressEventHandler(this.txt_guodao_KeyPress);
            this.txt_chufang.Location = new System.Drawing.Point(0xba, 0x48);
            this.txt_chufang.Name = "txt_chufang";
            this.txt_chufang.Size = new Size(0x41, 0x15);
            this.txt_chufang.TabIndex = 4;
            this.txt_chufang.Text = "0";
            this.txt_chufang.TextAlign = HorizontalAlignment.Right;
            this.txt_chufang.KeyPress += new KeyPressEventHandler(this.txt_chufang_KeyPress);
            this.txt_yangtai.Location = new System.Drawing.Point(0x40, 0x48);
            this.txt_yangtai.Name = "txt_yangtai";
            this.txt_yangtai.Size = new Size(0x41, 0x15);
            this.txt_yangtai.TabIndex = 3;
            this.txt_yangtai.Text = "0";
            this.txt_yangtai.TextAlign = HorizontalAlignment.Right;
            this.txt_yangtai.KeyPress += new KeyPressEventHandler(this.txt_yangtai_KeyPress);
            this.txt_wei.Location = new System.Drawing.Point(0x124, 0x20);
            this.txt_wei.Name = "txt_wei";
            this.txt_wei.Size = new Size(0x41, 0x15);
            this.txt_wei.TabIndex = 2;
            this.txt_wei.Text = "1";
            this.txt_wei.TextAlign = HorizontalAlignment.Right;
            this.txt_wei.KeyPress += new KeyPressEventHandler(this.txt_wei_KeyPress);
            this.txt_ting.Location = new System.Drawing.Point(0xba, 0x22);
            this.txt_ting.Name = "txt_ting";
            this.txt_ting.Size = new Size(0x41, 0x15);
            this.txt_ting.TabIndex = 1;
            this.txt_ting.Text = "1";
            this.txt_ting.TextAlign = HorizontalAlignment.Right;
            this.txt_ting.KeyPress += new KeyPressEventHandler(this.txt_ting_KeyPress);
            this.txt_shi.Location = new System.Drawing.Point(0x40, 0x22);
            this.txt_shi.Name = "txt_shi";
            this.txt_shi.Size = new Size(0x41, 0x15);
            this.txt_shi.TabIndex = 0;
            this.txt_shi.Text = "3";
            this.txt_shi.TextAlign = HorizontalAlignment.Right;
            this.txt_shi.KeyPress += new KeyPressEventHandler(this.txt_shi_KeyPress);
            this.label11.AutoSize = true;
            this.label11.Location = new System.Drawing.Point(0xfd, 0x95);
            this.label11.Name = "label11";
            this.label11.Size = new Size(0x1d, 12);
            this.label11.TabIndex = 10;
            this.label11.Text = "其他";
            this.label10.AutoSize = true;
            this.label10.Location = new System.Drawing.Point(0x83, 150);
            this.label10.Name = "label10";
            this.label10.Size = new Size(0x1d, 12);
            this.label10.TabIndex = 9;
            this.label10.Text = "水电";
            this.label9.AutoSize = true;
            this.label9.Location = new System.Drawing.Point(0x16c, 0x6f);
            this.label9.Name = "label9";
            this.label9.Size = new Size(0x1d, 12);
            this.label9.TabIndex = 8;
            this.label9.Text = "楼梯";
            this.label8.AutoSize = true;
            this.label8.Location = new System.Drawing.Point(0xfd, 0x70);
            this.label8.Name = "label8";
            this.label8.Size = new Size(0x1d, 12);
            this.label8.TabIndex = 7;
            this.label8.Text = "玄关";
            this.label7.AutoSize = true;
            this.label7.Location = new System.Drawing.Point(0x84, 0x73);
            this.label7.Name = "label7";
            this.label7.Size = new Size(0x29, 12);
            this.label7.TabIndex = 6;
            this.label7.Text = "储物间";
            this.label6.AutoSize = true;
            this.label6.Location = new System.Drawing.Point(0x16b, 0x4c);
            this.label6.Name = "label6";
            this.label6.Size = new Size(0x1d, 12);
            this.label6.TabIndex = 5;
            this.label6.Text = "过道";
            this.label5.AutoSize = true;
            this.label5.Location = new System.Drawing.Point(0xfd, 0x4c);
            this.label5.Name = "label5";
            this.label5.Size = new Size(0x1d, 12);
            this.label5.TabIndex = 4;
            this.label5.Text = "厨房";
            this.label4.AutoSize = true;
            this.label4.Location = new System.Drawing.Point(0x84, 80);
            this.label4.Name = "label4";
            this.label4.Size = new Size(0x1d, 12);
            this.label4.TabIndex = 3;
            this.label4.Text = "阳台";
            this.label3.AutoSize = true;
            this.label3.Location = new System.Drawing.Point(0x16b, 0x25);
            this.label3.Name = "label3";
            this.label3.Size = new Size(0x11, 12);
            this.label3.TabIndex = 2;
            this.label3.Text = "卫";
            this.label2.AutoSize = true;
            this.label2.Location = new System.Drawing.Point(0x101, 0x26);
            this.label2.Name = "label2";
            this.label2.Size = new Size(0x11, 12);
            this.label2.TabIndex = 1;
            this.label2.Text = "厅";
            this.label1.AutoSize = true;
            this.label1.Location = new System.Drawing.Point(0x84, 40);
            this.label1.Name = "label1";
            this.label1.Size = new Size(0x11, 12);
            this.label1.TabIndex = 1;
            this.label1.Text = "室";
            this.tclHNM.Controls.Add(this.tbpHouseType);
            this.tclHNM.Controls.Add(this.tbpItemInfo);
            this.tclHNM.Controls.Add(this.tbpNewBudget);
            this.tclHNM.Dock = DockStyle.Fill;
            this.tclHNM.Location = new System.Drawing.Point(0, 0);
            this.tclHNM.Name = "tclHNM";
            this.tclHNM.SelectedIndex = 0;
            this.tclHNM.Size = new Size(0x3b0, 0x238);
            this.tclHNM.TabIndex = 3;
            this.tclHNM.SelectedIndexChanged += new EventHandler(this.tclHNM_SelectedIndexChanged);
            this.tbpHouseType.Controls.Add(this.label34);
            this.tbpHouseType.Controls.Add(this.lblProAddress);
            this.tbpHouseType.Controls.Add(this.lblDesigner);
            this.tbpHouseType.Controls.Add(this.lblCustomerPhone);
            this.tbpHouseType.Controls.Add(this.lblCustomerName);
            this.tbpHouseType.Controls.Add(this.pnlSelectHouse);
            this.tbpHouseType.Location = new System.Drawing.Point(4, 0x15);
            this.tbpHouseType.Name = "tbpHouseType";
            this.tbpHouseType.Padding = new Padding(3);
            this.tbpHouseType.Size = new Size(0x3a8, 0x21f);
            this.tbpHouseType.TabIndex = 0;
            this.tbpHouseType.Text = "选择户型";
            this.tbpHouseType.UseVisualStyleBackColor = true;
            this.tbpHouseType.Click += new EventHandler(this.tbpHouseType_Click);
            this.label34.Location = new System.Drawing.Point(0x11, 0x201);
            this.label34.Name = "label34";
            this.label34.Size = new Size(0x69, 10);
            this.label34.TabIndex = 5;
            this.label34.Visible = false;
            this.lblProAddress.Location = new System.Drawing.Point(0x15, 0x1e7);
            this.lblProAddress.Name = "lblProAddress";
            this.lblProAddress.Size = new Size(0x69, 10);
            this.lblProAddress.TabIndex = 4;
            this.lblProAddress.Visible = false;
            this.lblDesigner.Location = new System.Drawing.Point(0x17, 0x1cd);
            this.lblDesigner.Name = "lblDesigner";
            this.lblDesigner.Size = new Size(0x69, 10);
            this.lblDesigner.TabIndex = 3;
            this.lblDesigner.Visible = false;
            this.lblCustomerPhone.Location = new System.Drawing.Point(0x47, 0x1b3);
            this.lblCustomerPhone.Name = "lblCustomerPhone";
            this.lblCustomerPhone.Size = new Size(0x69, 10);
            this.lblCustomerPhone.TabIndex = 2;
            this.lblCustomerPhone.Visible = false;
            this.lblCustomerName.Location = new System.Drawing.Point(0x44, 400);
            this.lblCustomerName.Name = "lblCustomerName";
            this.lblCustomerName.Size = new Size(0x62, 10);
            this.lblCustomerName.TabIndex = 1;
            this.lblCustomerName.Visible = false;
            this.tbpItemInfo.Controls.Add(this.panel1111);
            this.tbpItemInfo.Location = new System.Drawing.Point(4, 0x15);
            this.tbpItemInfo.Name = "tbpItemInfo";
            this.tbpItemInfo.Size = new Size(0x3a8, 0x21f);
            this.tbpItemInfo.TabIndex = 2;
            this.tbpItemInfo.Text = "工程信息";
            this.tbpItemInfo.UseVisualStyleBackColor = true;
            this.panel1111.Controls.Add(this.label30);
            this.panel1111.Controls.Add(this.btn_Delete_Budget);
            this.panel1111.Controls.Add(this.btnCopyBudget);
            this.panel1111.Controls.Add(this.btn_New_budget);
            this.panel1111.Controls.Add(this.panel1);
            this.panel1111.Controls.Add(this.treeView1);
            this.panel1111.Dock = DockStyle.Fill;
            this.panel1111.Location = new System.Drawing.Point(0, 0);
            this.panel1111.Name = "panel1111";
            this.panel1111.Size = new Size(0x3a8, 0x21f);
            this.panel1111.TabIndex = 1;
            this.panel1111.Paint += new PaintEventHandler(this.panel1111_Paint);
            this.btn_Delete_Budget.Anchor = AnchorStyles.Right | AnchorStyles.Bottom;
            this.btn_Delete_Budget.Location = new System.Drawing.Point(0x144, 0x1e5);
            this.btn_Delete_Budget.Name = "btn_Delete_Budget";
            this.btn_Delete_Budget.Size = new Size(0x60, 0x17);
            this.btn_Delete_Budget.TabIndex = 4;
            this.btn_Delete_Budget.Text = "删除工程(&D)";
            this.btn_Delete_Budget.UseVisualStyleBackColor = true;
            this.btn_Delete_Budget.Click += new EventHandler(this.btn_Delete_Budget_Click);
            this.btnCopyBudget.Anchor = AnchorStyles.Right | AnchorStyles.Bottom;
            this.btnCopyBudget.Location = new System.Drawing.Point(0xe0, 0x1e5);
            this.btnCopyBudget.Name = "btnCopyBudget";
            this.btnCopyBudget.Size = new Size(0x5e, 0x17);
            this.btnCopyBudget.TabIndex = 3;
            this.btnCopyBudget.Text = "复制工程(&C)";
            this.btnCopyBudget.UseVisualStyleBackColor = true;
            this.btnCopyBudget.Click += new EventHandler(this.btnCopyBudget_Click);
            this.btn_New_budget.Anchor = AnchorStyles.Right | AnchorStyles.Bottom;
            this.btn_New_budget.Location = new System.Drawing.Point(0x7f, 0x1e5);
            this.btn_New_budget.Name = "btn_New_budget";
            this.btn_New_budget.Size = new Size(0x5b, 0x17);
            this.btn_New_budget.TabIndex = 2;
            this.btn_New_budget.Text = "新添工程(&A)";
            this.btn_New_budget.UseVisualStyleBackColor = true;
            this.btn_New_budget.Click += new EventHandler(this.btn_New_budget_Click);
            this.panel1.Anchor = AnchorStyles.Right | AnchorStyles.Left | AnchorStyles.Bottom | AnchorStyles.Top;
            this.panel1.BackColor = Color.Lavender;
            this.panel1.BorderStyle = BorderStyle.Fixed3D;
            this.panel1.Controls.Add(this.textBox1);
            this.panel1.Controls.Add(this.lbl_SheJiTu);
            this.panel1.Controls.Add(this.lbl_YuSuan);
            this.panel1.Controls.Add(this.lbl_cust_idea);
            this.panel1.Controls.Add(this.lbl_GongChang);
            this.panel1.Controls.Add(this.lbl_ShiGong_date);
            this.panel1.Controls.Add(this.lbl_HeTong_price);
            this.panel1.Controls.Add(this.lbl_style);
            this.panel1.Controls.Add(this.lbl_Qiandan_date);
            this.panel1.Controls.Add(this.lbl_housetype);
            this.panel1.Controls.Add(this.lbl_address);
            this.panel1.Controls.Add(this.lbl_area);
            this.panel1.Controls.Add(this.lbl_phone);
            this.panel1.Controls.Add(this.lbl_designer);
            this.panel1.Controls.Add(this.lbl_custname);
            this.panel1.Controls.Add(this.btn_SheJiTu_mingxi);
            this.panel1.Controls.Add(this.btn_YuSuan_mingxi);
            this.panel1.Controls.Add(this.label14);
            this.panel1.Controls.Add(this.label16);
            this.panel1.Controls.Add(this.label17);
            this.panel1.Controls.Add(this.label18);
            this.panel1.Controls.Add(this.label19);
            this.panel1.Controls.Add(this.label20);
            this.panel1.Controls.Add(this.label21);
            this.panel1.Controls.Add(this.label22);
            this.panel1.Controls.Add(this.label23);
            this.panel1.Controls.Add(this.label24);
            this.panel1.Controls.Add(this.label25);
            this.panel1.Controls.Add(this.label26);
            this.panel1.Controls.Add(this.label27);
            this.panel1.Controls.Add(this.label28);
            this.panel1.Location = new System.Drawing.Point(0x106, 1);
            this.panel1.Name = "panel1";
            this.panel1.Size = new Size(0x182, 460);
            this.panel1.TabIndex = 1;
            this.textBox1.BackColor = Color.Lavender;
            this.textBox1.BorderStyle = BorderStyle.None;
            this.textBox1.Location = new System.Drawing.Point(0x42, 0xc9);
            this.textBox1.Multiline = true;
            this.textBox1.Name = "textBox1";
            this.textBox1.ReadOnly = true;
            this.textBox1.Size = new Size(0x129, 0x84);
            this.textBox1.TabIndex = 0x1f;
            this.textBox1.MouseClick += new MouseEventHandler(this.textBox1_MouseClick);
            this.textBox1.MouseEnter += new EventHandler(this.textBox1_MouseEnter);
            this.lbl_SheJiTu.AutoSize = true;
            this.lbl_SheJiTu.ForeColor = SystemColors.HotTrack;
            this.lbl_SheJiTu.Location = new System.Drawing.Point(0x4f, 0x17e);
            this.lbl_SheJiTu.Name = "lbl_SheJiTu";
            this.lbl_SheJiTu.Size = new Size(0, 12);
            this.lbl_SheJiTu.TabIndex = 30;
            this.lbl_YuSuan.AutoSize = true;
            this.lbl_YuSuan.ForeColor = SystemColors.HotTrack;
            this.lbl_YuSuan.Location = new System.Drawing.Point(0x4f, 0x158);
            this.lbl_YuSuan.Name = "lbl_YuSuan";
            this.lbl_YuSuan.Size = new Size(0, 12);
            this.lbl_YuSuan.TabIndex = 0x1d;
            this.lbl_cust_idea.AutoSize = true;
            this.lbl_cust_idea.ForeColor = SystemColors.HotTrack;
            this.lbl_cust_idea.Location = new System.Drawing.Point(0x40, 0xc9);
            this.lbl_cust_idea.Name = "lbl_cust_idea";
            this.lbl_cust_idea.Size = new Size(11, 12);
            this.lbl_cust_idea.TabIndex = 0x1c;
            this.lbl_cust_idea.Text = " ";
            this.lbl_GongChang.AutoSize = true;
            this.lbl_GongChang.ForeColor = SystemColors.HotTrack;
            this.lbl_GongChang.Location = new System.Drawing.Point(0x40, 0xab);
            this.lbl_GongChang.Name = "lbl_GongChang";
            this.lbl_GongChang.Size = new Size(11, 12);
            this.lbl_GongChang.TabIndex = 0x1b;
            this.lbl_GongChang.Text = " ";
            this.lbl_ShiGong_date.AutoSize = true;
            this.lbl_ShiGong_date.ForeColor = SystemColors.HotTrack;
            this.lbl_ShiGong_date.Location = new System.Drawing.Point(0x40, 0x90);
            this.lbl_ShiGong_date.Name = "lbl_ShiGong_date";
            this.lbl_ShiGong_date.Size = new Size(11, 12);
            this.lbl_ShiGong_date.TabIndex = 0x1a;
            this.lbl_ShiGong_date.Text = " ";
            this.lbl_HeTong_price.AutoSize = true;
            this.lbl_HeTong_price.ForeColor = SystemColors.HotTrack;
            this.lbl_HeTong_price.Location = new System.Drawing.Point(0xda, 0x74);
            this.lbl_HeTong_price.Name = "lbl_HeTong_price";
            this.lbl_HeTong_price.Size = new Size(11, 12);
            this.lbl_HeTong_price.TabIndex = 0x19;
            this.lbl_HeTong_price.Text = " ";
            this.lbl_style.AutoSize = true;
            this.lbl_style.ForeColor = SystemColors.HotTrack;
            this.lbl_style.Location = new System.Drawing.Point(0xda, 0x54);
            this.lbl_style.Name = "lbl_style";
            this.lbl_style.Size = new Size(11, 12);
            this.lbl_style.TabIndex = 0x18;
            this.lbl_style.Text = " ";
            this.lbl_Qiandan_date.AutoSize = true;
            this.lbl_Qiandan_date.ForeColor = SystemColors.HotTrack;
            this.lbl_Qiandan_date.Location = new System.Drawing.Point(0x42, 0x74);
            this.lbl_Qiandan_date.Name = "lbl_Qiandan_date";
            this.lbl_Qiandan_date.Size = new Size(11, 12);
            this.lbl_Qiandan_date.TabIndex = 0x17;
            this.lbl_Qiandan_date.Text = " ";
            this.lbl_housetype.AutoSize = true;
            this.lbl_housetype.ForeColor = SystemColors.HotTrack;
            this.lbl_housetype.Location = new System.Drawing.Point(0x40, 0x55);
            this.lbl_housetype.Name = "lbl_housetype";
            this.lbl_housetype.Size = new Size(11, 12);
            this.lbl_housetype.TabIndex = 0x16;
            this.lbl_housetype.Text = " ";
            this.lbl_address.AutoSize = true;
            this.lbl_address.ForeColor = SystemColors.HotTrack;
            this.lbl_address.Location = new System.Drawing.Point(0x47, 0x3a);
            this.lbl_address.Name = "lbl_address";
            this.lbl_address.Size = new Size(0, 12);
            this.lbl_address.TabIndex = 0x15;
            this.lbl_area.AutoSize = true;
            this.lbl_area.ForeColor = SystemColors.HotTrack;
            this.lbl_area.Location = new System.Drawing.Point(0xda, 0x20);
            this.lbl_area.Name = "lbl_area";
            this.lbl_area.Size = new Size(11, 12);
            this.lbl_area.TabIndex = 20;
            this.lbl_area.Text = " ";
            this.lbl_phone.AutoSize = true;
            this.lbl_phone.ForeColor = SystemColors.HotTrack;
            this.lbl_phone.Location = new System.Drawing.Point(0x42, 0x1f);
            this.lbl_phone.Name = "lbl_phone";
            this.lbl_phone.Size = new Size(11, 12);
            this.lbl_phone.TabIndex = 0x13;
            this.lbl_phone.Text = " ";
            this.lbl_designer.AutoSize = true;
            this.lbl_designer.ForeColor = SystemColors.HotTrack;
            this.lbl_designer.Location = new System.Drawing.Point(0xd8, 7);
            this.lbl_designer.Name = "lbl_designer";
            this.lbl_designer.Size = new Size(11, 12);
            this.lbl_designer.TabIndex = 0x12;
            this.lbl_designer.Text = " ";
            this.lbl_custname.AutoSize = true;
            this.lbl_custname.ForeColor = SystemColors.HotTrack;
            this.lbl_custname.Location = new System.Drawing.Point(0x42, 7);
            this.lbl_custname.Name = "lbl_custname";
            this.lbl_custname.Size = new Size(11, 12);
            this.lbl_custname.TabIndex = 0x11;
            this.lbl_custname.Text = " ";
            this.lbl_custname.TextAlign = ContentAlignment.MiddleCenter;
            this.btn_SheJiTu_mingxi.BackColor = Color.GhostWhite;
            this.btn_SheJiTu_mingxi.Location = new System.Drawing.Point(0xc7, 0x179);
            this.btn_SheJiTu_mingxi.Name = "btn_SheJiTu_mingxi";
            this.btn_SheJiTu_mingxi.Size = new Size(60, 0x17);
            this.btn_SheJiTu_mingxi.TabIndex = 0x10;
            this.btn_SheJiTu_mingxi.Text = "明细(&I)";
            this.btn_SheJiTu_mingxi.UseVisualStyleBackColor = false;
            this.btn_SheJiTu_mingxi.Click += new EventHandler(this.btn_SheJiTu_mingxi_Click);
            this.btn_YuSuan_mingxi.BackColor = Color.GhostWhite;
            this.btn_YuSuan_mingxi.Location = new System.Drawing.Point(0xc7, 0x153);
            this.btn_YuSuan_mingxi.Name = "btn_YuSuan_mingxi";
            this.btn_YuSuan_mingxi.Size = new Size(60, 0x17);
            this.btn_YuSuan_mingxi.TabIndex = 15;
            this.btn_YuSuan_mingxi.Text = "明细(&L)";
            this.btn_YuSuan_mingxi.UseVisualStyleBackColor = false;
            this.btn_YuSuan_mingxi.Click += new EventHandler(this.btn_YuSuan_mingxi_Click);
            this.label14.AutoSize = true;
            this.label14.Location = new System.Drawing.Point(3, 0xca);
            this.label14.Name = "label14";
            this.label14.Size = new Size(0x41, 12);
            this.label14.TabIndex = 14;
            this.label14.Text = "客户想法：";
            this.label16.AutoSize = true;
            this.label16.Location = new System.Drawing.Point(7, 0x17f);
            this.label16.Name = "label16";
            this.label16.Size = new Size(0x41, 12);
            this.label16.TabIndex = 12;
            this.label16.Text = "设 计 图：";
            this.label17.AutoSize = true;
            this.label17.Location = new System.Drawing.Point(8, 0x158);
            this.label17.Name = "label17";
            this.label17.Size = new Size(0x41, 12);
            this.label17.TabIndex = 11;
            this.label17.Text = "预    算：";
            this.label18.AutoSize = true;
            this.label18.Location = new System.Drawing.Point(3, 0xac);
            this.label18.Name = "label18";
            this.label18.Size = new Size(0x41, 12);
            this.label18.TabIndex = 10;
            this.label18.Text = "工    长：";
            this.label19.AutoSize = true;
            this.label19.Location = new System.Drawing.Point(0x9c, 7);
            this.label19.Name = "label19";
            this.label19.Size = new Size(0x41, 12);
            this.label19.TabIndex = 9;
            this.label19.Text = "设 计 师：";
            this.label20.AutoSize = true;
            this.label20.Location = new System.Drawing.Point(3, 0x90);
            this.label20.Name = "label20";
            this.label20.Size = new Size(0x41, 12);
            this.label20.TabIndex = 8;
            this.label20.Text = "施工日期：";
            this.label21.AutoSize = true;
            this.label21.Location = new System.Drawing.Point(3, 0x55);
            this.label21.Name = "label21";
            this.label21.Size = new Size(0x41, 12);
            this.label21.TabIndex = 7;
            this.label21.Text = "户    型：";
            this.label21.Click += new EventHandler(this.label21_Click);
            this.label22.AutoSize = true;
            this.label22.Location = new System.Drawing.Point(3, 0x74);
            this.label22.Name = "label22";
            this.label22.Size = new Size(0x41, 12);
            this.label22.TabIndex = 6;
            this.label22.Text = "签单日期：";
            this.label23.AutoSize = true;
            this.label23.Location = new System.Drawing.Point(0x9c, 0x20);
            this.label23.Name = "label23";
            this.label23.Size = new Size(0x41, 12);
            this.label23.TabIndex = 5;
            this.label23.Text = "建筑面积：";
            this.label24.AutoSize = true;
            this.label24.Location = new System.Drawing.Point(0x9c, 0x55);
            this.label24.Name = "label24";
            this.label24.Size = new Size(0x41, 12);
            this.label24.TabIndex = 4;
            this.label24.Text = "装修风格：";
            this.label25.AutoSize = true;
            this.label25.Location = new System.Drawing.Point(0x9c, 0x74);
            this.label25.Name = "label25";
            this.label25.Size = new Size(0x41, 12);
            this.label25.TabIndex = 3;
            this.label25.Text = "合同价格：";
            this.label26.AutoSize = true;
            this.label26.Location = new System.Drawing.Point(5, 0x3a);
            this.label26.Name = "label26";
            this.label26.Size = new Size(0x41, 12);
            this.label26.TabIndex = 2;
            this.label26.Text = "地    址：";
            this.label27.AutoSize = true;
            this.label27.Location = new System.Drawing.Point(4, 0x20);
            this.label27.Name = "label27";
            this.label27.Size = new Size(0x41, 12);
            this.label27.TabIndex = 1;
            this.label27.Text = "联系电话：";
            this.label28.AutoSize = true;
            this.label28.Location = new System.Drawing.Point(4, 7);
            this.label28.Name = "label28";
            this.label28.Size = new Size(0x41, 12);
            this.label28.TabIndex = 0;
            this.label28.Text = "客户名称：";
            this.treeView1.Anchor = AnchorStyles.Right | AnchorStyles.Left | AnchorStyles.Bottom | AnchorStyles.Top;
            this.treeView1.Font = new System.Drawing.Font("新宋体", 9f, FontStyle.Regular, GraphicsUnit.Point, 0x86);
            this.treeView1.ImageIndex = 0;
            this.treeView1.ImageList = this.imageList1;
            this.treeView1.Location = new System.Drawing.Point(3, 1);
            this.treeView1.Name = "treeView1";
            this.treeView1.SelectedImageIndex = 0;
            this.treeView1.Size = new Size(0x103, 460);
            this.treeView1.TabIndex = 0;
            this.treeView1.AfterSelect += new TreeViewEventHandler(this.treeView1_AfterSelect);
            this.imageList1.ImageStream = (ImageListStreamer) manager.GetObject("imageList1.ImageStream");
            this.imageList1.TransparentColor = Color.Transparent;
            this.imageList1.Images.SetKeyName(0, "");
            this.imageList1.Images.SetKeyName(1, "");
            this.imageList1.Images.SetKeyName(2, "");
            this.imageList1.Images.SetKeyName(3, "");
            this.imageList1.Images.SetKeyName(4, "");
            this.imageList1.Images.SetKeyName(5, "makefileappwiz.ico");
            this.imageList1.Images.SetKeyName(6, "SNAPIN.ICO");
            this.tbpNewBudget.Controls.Add(this.splitContainer1);
            this.tbpNewBudget.Location = new System.Drawing.Point(4, 0x15);
            this.tbpNewBudget.Name = "tbpNewBudget";
            this.tbpNewBudget.Padding = new Padding(3);
            this.tbpNewBudget.Size = new Size(0x3a8, 0x21f);
            this.tbpNewBudget.TabIndex = 1;
            this.tbpNewBudget.Text = "新预算";
            this.tbpNewBudget.UseVisualStyleBackColor = true;
            this.tbpNewBudget.Click += new EventHandler(this.tbpNewBudget_Click);
            this.splitContainer1.Dock = DockStyle.Fill;
            this.splitContainer1.Location = new System.Drawing.Point(3, 3);
            this.splitContainer1.Name = "splitContainer1";
            this.splitContainer1.Panel1.AutoScroll = true;
            this.splitContainer1.Panel1.Controls.Add(this.pnlNewBudget);
            this.splitContainer1.Panel2.Controls.Add(this.panel4);
            this.splitContainer1.Size = new Size(930, 0x219);
            this.splitContainer1.SplitterDistance = 0x25e;
            this.splitContainer1.TabIndex = 3;
            this.pnlNewBudget.BorderStyle = BorderStyle.FixedSingle;
            this.pnlNewBudget.Controls.Add(this.panel2);
            this.pnlNewBudget.Controls.Add(this.panel3);
            this.pnlNewBudget.Controls.Add(this.pnlNewBudTop);
            this.pnlNewBudget.Dock = DockStyle.Fill;
            this.pnlNewBudget.Location = new System.Drawing.Point(0, 0);
            this.pnlNewBudget.Name = "pnlNewBudget";
            this.pnlNewBudget.Size = new Size(0x25e, 0x219);
            this.pnlNewBudget.TabIndex = 4;
            this.panel2.Controls.Add(this.tgdvTest);
            this.panel2.Dock = DockStyle.Fill;
            this.panel2.Location = new System.Drawing.Point(0, 0x30);
            this.panel2.Name = "panel2";
            this.panel2.Size = new Size(0x25c, 0x19f);
            this.panel2.TabIndex = 3;
            this.panel4.BorderStyle = BorderStyle.FixedSingle;
            this.panel4.Controls.Add(this.panel7);
            this.panel4.Controls.Add(this.panel5);
            this.panel4.Dock = DockStyle.Fill;
            this.panel4.Location = new System.Drawing.Point(0, 0);
            this.panel4.Name = "panel4";
            this.panel4.Size = new Size(320, 0x219);
            this.panel4.TabIndex = 12;
            this.panel7.Controls.Add(this.dataGridView2);
            this.panel7.Dock = DockStyle.Fill;
            this.panel7.Location = new System.Drawing.Point(0, 0x41);
            this.panel7.Name = "panel7";
            this.panel7.Size = new Size(0x13e, 470);
            this.panel7.TabIndex = 14;
            this.dataGridView2.AllowUserToAddRows = false;
            this.dataGridView2.AllowUserToResizeRows = false;
            this.dataGridView2.AutoSizeColumnsMode = DataGridViewAutoSizeColumnsMode.Fill;
            this.dataGridView2.BackgroundColor = SystemColors.ControlLightLight;
            style12.Alignment = DataGridViewContentAlignment.MiddleLeft;
            style12.BackColor = SystemColors.Control;
            style12.Font = new System.Drawing.Font("宋体", 9f, FontStyle.Regular, GraphicsUnit.Point, 0x86);
            style12.ForeColor = SystemColors.WindowText;
            style12.SelectionBackColor = SystemColors.Highlight;
            style12.SelectionForeColor = SystemColors.HighlightText;
            style12.WrapMode = DataGridViewTriState.True;
            this.dataGridView2.ColumnHeadersDefaultCellStyle = style12;
            this.dataGridView2.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.AutoSize;
            this.dataGridView2.Columns.AddRange(new DataGridViewColumn[] { this.dataGridViewTextBoxColumn7, this.dataGridViewTextBoxColumn5, this.dataGridViewTextBoxColumn6, this.Column1, this.Column8 });
            style13.Alignment = DataGridViewContentAlignment.MiddleLeft;
            style13.BackColor = SystemColors.Window;
            style13.Font = new System.Drawing.Font("宋体", 9f, FontStyle.Regular, GraphicsUnit.Point, 0x86);
            style13.ForeColor = SystemColors.ControlText;
            style13.SelectionBackColor = SystemColors.Highlight;
            style13.SelectionForeColor = SystemColors.HighlightText;
            style13.WrapMode = DataGridViewTriState.False;
            this.dataGridView2.DefaultCellStyle = style13;
            this.dataGridView2.Dock = DockStyle.Fill;
            this.dataGridView2.Location = new System.Drawing.Point(0, 0);
            this.dataGridView2.MultiSelect = false;
            this.dataGridView2.Name = "dataGridView2";
            this.dataGridView2.ReadOnly = true;
            style14.Alignment = DataGridViewContentAlignment.MiddleLeft;
            style14.BackColor = SystemColors.Control;
            style14.Font = new System.Drawing.Font("宋体", 9f, FontStyle.Regular, GraphicsUnit.Point, 0x86);
            style14.ForeColor = SystemColors.WindowText;
            style14.SelectionBackColor = SystemColors.Highlight;
            style14.SelectionForeColor = SystemColors.HighlightText;
            style14.WrapMode = DataGridViewTriState.True;
            this.dataGridView2.RowHeadersDefaultCellStyle = style14;
            this.dataGridView2.RowHeadersVisible = false;
            style15.Alignment = DataGridViewContentAlignment.MiddleLeft;
            this.dataGridView2.RowsDefaultCellStyle = style15;
            this.dataGridView2.RowTemplate.Height = 0x17;
            this.dataGridView2.SelectionMode = DataGridViewSelectionMode.FullRowSelect;
            this.dataGridView2.Size = new Size(0x13e, 470);
            this.dataGridView2.TabIndex = 10;
            this.dataGridView2.CellDoubleClick += new DataGridViewCellEventHandler(this.dataGridView2_CellDoubleClick);
            this.dataGridView2.CellContentClick += new DataGridViewCellEventHandler(this.dataGridView2_CellContentClick);
            style16.Alignment = DataGridViewContentAlignment.MiddleRight;
            this.dataGridViewTextBoxColumn7.DefaultCellStyle = style16;
            this.dataGridViewTextBoxColumn7.HeaderText = "单价";
            this.dataGridViewTextBoxColumn7.Name = "dataGridViewTextBoxColumn7";
            this.dataGridViewTextBoxColumn7.ReadOnly = true;
            this.dataGridViewTextBoxColumn7.SortMode = DataGridViewColumnSortMode.NotSortable;
            this.dataGridViewTextBoxColumn5.HeaderText = "名称";
            this.dataGridViewTextBoxColumn5.Name = "dataGridViewTextBoxColumn5";
            this.dataGridViewTextBoxColumn5.ReadOnly = true;
            this.dataGridViewTextBoxColumn5.SortMode = DataGridViewColumnSortMode.NotSortable;
            this.dataGridViewTextBoxColumn6.HeaderText = "单位";
            this.dataGridViewTextBoxColumn6.Name = "dataGridViewTextBoxColumn6";
            this.dataGridViewTextBoxColumn6.ReadOnly = true;
            this.dataGridViewTextBoxColumn6.SortMode = DataGridViewColumnSortMode.NotSortable;
            this.Column1.HeaderText = "工艺";
            this.Column1.Name = "Column1";
            this.Column1.ReadOnly = true;
            this.Column8.HeaderText = "编号";
            this.Column8.Name = "Column8";
            this.Column8.ReadOnly = true;
            this.Column8.Visible = false;
            this.panel5.Controls.Add(this.btnHidden);
            this.panel5.Controls.Add(this.comboBox_MaterType);
            this.panel5.Controls.Add(this.label15);
            this.panel5.Dock = DockStyle.Top;
            this.panel5.Location = new System.Drawing.Point(0, 0);
            this.panel5.Name = "panel5";
            this.panel5.Size = new Size(0x13e, 0x41);
            this.panel5.TabIndex = 12;
            this.btnHidden.Location = new System.Drawing.Point(0xde, 0x18);
            this.btnHidden.Name = "btnHidden";
            this.btnHidden.Size = new Size(0x4b, 0x17);
            this.btnHidden.TabIndex = 10;
            this.btnHidden.Text = "隐藏(&H)";
            this.btnHidden.UseVisualStyleBackColor = true;
            this.btnHidden.Click += new EventHandler(this.btnHidden_Click);
            this.comboBox_MaterType.DropDownStyle = ComboBoxStyle.DropDownList;
            this.comboBox_MaterType.FormattingEnabled = true;
            this.comboBox_MaterType.Location = new System.Drawing.Point(0x52, 0x1a);
            this.comboBox_MaterType.Name = "comboBox_MaterType";
            this.comboBox_MaterType.Size = new Size(0x73, 20);
            this.comboBox_MaterType.TabIndex = 9;
            this.comboBox_MaterType.SelectedIndexChanged += new EventHandler(this.comboBox_MaterType_SelectedIndexChanged);
            this.label15.AutoSize = true;
            this.label15.Location = new System.Drawing.Point(0x10, 0x1d);
            this.label15.Name = "label15";
            this.label15.Size = new Size(0x41, 12);
            this.label15.TabIndex = 8;
            this.label15.Text = "项目类别：";
            this.printDocumentBill.PrintPage += new PrintPageEventHandler(this.printDocumentBill_PrintPage);
            this.printPreviewDialogBill.AutoScrollMargin = new Size(0, 0);
            this.printPreviewDialogBill.AutoScrollMinSize = new Size(0, 0);
            this.printPreviewDialogBill.ClientSize = new Size(0x18e, 0x12a);
            this.printPreviewDialogBill.Enabled = true;
            this.printPreviewDialogBill.Icon = (Icon) manager.GetObject("printPreviewDialogBill.Icon");
            this.printPreviewDialogBill.Name = "printPreviewDialogBill";
            this.printPreviewDialogBill.Visible = false;
            this.openFileDialog1.FileName = "openFileDialog1";
            style17.Alignment = DataGridViewContentAlignment.MiddleCenter;
            this.dataGridViewTextBoxColumn1.DefaultCellStyle = style17;
            this.dataGridViewTextBoxColumn1.HeaderText = "物料名称";
            this.dataGridViewTextBoxColumn1.Name = "dataGridViewTextBoxColumn1";
            this.dataGridViewTextBoxColumn1.ReadOnly = true;
            this.dataGridViewTextBoxColumn1.SortMode = DataGridViewColumnSortMode.NotSortable;
            this.dataGridViewTextBoxColumn1.Width = 160;
            this.dataGridViewTextBoxColumn2.HeaderText = "单位";
            this.dataGridViewTextBoxColumn2.Name = "dataGridViewTextBoxColumn2";
            this.dataGridViewTextBoxColumn2.ReadOnly = true;
            this.dataGridViewTextBoxColumn2.SortMode = DataGridViewColumnSortMode.NotSortable;
            this.dataGridViewTextBoxColumn2.Width = 70;
            style18.Alignment = DataGridViewContentAlignment.MiddleRight;
            this.dataGridViewTextBoxColumn3.DefaultCellStyle = style18;
            this.dataGridViewTextBoxColumn3.HeaderText = "单价";
            this.dataGridViewTextBoxColumn3.Name = "dataGridViewTextBoxColumn3";
            this.dataGridViewTextBoxColumn3.ReadOnly = true;
            this.dataGridViewTextBoxColumn3.SortMode = DataGridViewColumnSortMode.NotSortable;
            this.dataGridViewTextBoxColumn3.Width = 80;
            this.dataGridViewTextBoxColumn4.HeaderText = "工艺做法及说明";
            this.dataGridViewTextBoxColumn4.Name = "dataGridViewTextBoxColumn4";
            this.dataGridViewTextBoxColumn4.ReadOnly = true;
            this.dataGridViewTextBoxColumn4.SortMode = DataGridViewColumnSortMode.NotSortable;
            this.dataGridViewTextBoxColumn4.Visible = false;
            this.dataGridViewTextBoxColumn4.Width = 350;
            this.dataGridViewTextBoxColumn8.HeaderText = "单位";
            this.dataGridViewTextBoxColumn8.Name = "dataGridViewTextBoxColumn8";
            this.dataGridViewTextBoxColumn8.ReadOnly = true;
            this.dataGridViewTextBoxColumn8.SortMode = DataGridViewColumnSortMode.NotSortable;
            this.dataGridViewTextBoxColumn8.Width = 0x52;
            style19.Alignment = DataGridViewContentAlignment.MiddleRight;
            this.dataGridViewTextBoxColumn9.DefaultCellStyle = style19;
            this.dataGridViewTextBoxColumn9.HeaderText = "单价";
            this.dataGridViewTextBoxColumn9.Name = "dataGridViewTextBoxColumn9";
            this.dataGridViewTextBoxColumn9.ReadOnly = true;
            this.dataGridViewTextBoxColumn9.SortMode = DataGridViewColumnSortMode.NotSortable;
            this.dataGridViewTextBoxColumn9.Width = 0x52;
            this.dataGridViewTextBoxColumn10.HeaderText = "工艺";
            this.dataGridViewTextBoxColumn10.Name = "dataGridViewTextBoxColumn10";
            this.dataGridViewTextBoxColumn10.ReadOnly = true;
            this.dataGridViewTextBoxColumn10.Width = 0x52;
            this.dataGridViewTextBoxColumn11.HeaderText = "编号";
            this.dataGridViewTextBoxColumn11.Name = "dataGridViewTextBoxColumn11";
            this.dataGridViewTextBoxColumn11.ReadOnly = true;
            this.dataGridViewTextBoxColumn11.Visible = false;
            this.label30.AutoSize = true;
            this.label30.Location = new System.Drawing.Point(8, 0x1e5);
            this.label30.Name = "label30";
            this.label30.Size = new Size(0, 12);
            this.label30.TabIndex = 5;
            this.label30.Visible = false;
            base.AutoScaleDimensions = new SizeF(6f, 12f);
            base.AutoScaleMode = AutoScaleMode.Font;
            base.ClientSize = new Size(0x3b0, 0x238);
            base.Controls.Add(this.tclHNM);
            base.FormBorderStyle = FormBorderStyle.FixedSingle;
            base.Name = "HouseTypeInfo";
            base.ShowInTaskbar = false;
            base.StartPosition = FormStartPosition.CenterParent;
            this.Text = "户型选择";
            base.Load += new EventHandler(this.HouseTypeInfo_Load);
            base.FormClosing += new FormClosingEventHandler(this.HouseTypeInfo_FormClosing);
            this.panel3.ResumeLayout(false);
            ((ISupportInitialize) this.dataGridView1).EndInit();
            ((ISupportInitialize) this.tgdvTest).EndInit();
            this.contextMenuStrip1.ResumeLayout(false);
            this.pnlNewBudTop.ResumeLayout(false);
            this.pnlNewBudTop.PerformLayout();
            this.pnlSelectHouse.ResumeLayout(false);
            this.groupBox1.ResumeLayout(false);
            this.groupBox1.PerformLayout();
            this.tclHNM.ResumeLayout(false);
            this.tbpHouseType.ResumeLayout(false);
            this.tbpItemInfo.ResumeLayout(false);
            this.panel1111.ResumeLayout(false);
            this.panel1111.PerformLayout();
            this.panel1.ResumeLayout(false);
            this.panel1.PerformLayout();
            this.tbpNewBudget.ResumeLayout(false);
            this.splitContainer1.Panel1.ResumeLayout(false);
            this.splitContainer1.Panel2.ResumeLayout(false);
            this.splitContainer1.ResumeLayout(false);
            this.pnlNewBudget.ResumeLayout(false);
            this.panel2.ResumeLayout(false);
            this.panel4.ResumeLayout(false);
            this.panel7.ResumeLayout(false);
            ((ISupportInitialize) this.dataGridView2).EndInit();
            this.panel5.ResumeLayout(false);
            this.panel5.PerformLayout();
            base.ResumeLayout(false);
        }

        private void label21_Click(object sender, EventArgs e)
        {
        }

        private void panel1111_Paint(object sender, PaintEventArgs e)
        {
        }

        private void printDocumentBill_PrintPage(object sender, PrintPageEventArgs e)
        {
            Graphics graphics = e.Graphics;
            int num = e.MarginBounds.Left - 0x37;
            try
            {
                int num7;
                System.Drawing.Font font = new System.Drawing.Font("宋体", 14f, FontStyle.Regular);
                System.Drawing.Font font2 = new System.Drawing.Font("宋体", 12f, FontStyle.Regular);
                graphics.DrawString("万泰建筑装饰工程有限公司", new System.Drawing.Font("宋体", 22f, FontStyle.Bold), new SolidBrush(Color.Black), (float) (num + 150), (float) ((e.PageBounds.Height / 10) - 80));
                graphics.DrawString(this.txtNewBudgetTitle.Text.Trim(), new System.Drawing.Font("宋体", 22f, FontStyle.Bold), new SolidBrush(Color.Black), (float) (num + 220), (float) ((e.PageBounds.Height / 10) - 40));
                graphics.DrawString("客户姓名：" + this.lblCustomerName.Text, font, new SolidBrush(Color.Black), (float) num, (float) ((e.MarginBounds.Height / 10) + 0x19));
                graphics.DrawString("联系电话：" + this.lblCustomerPhone.Text, font, new SolidBrush(Color.Black), (float) (num + 240), (float) ((e.MarginBounds.Height / 10) + 0x19));
                graphics.DrawString("设计师：" + this.lblDesigner.Text, font, new SolidBrush(Color.Black), (float) (num + 500), (float) ((e.MarginBounds.Height / 10) + 0x19));
                graphics.DrawString("工程地址：" + this.lblProAddress.Text, font, new SolidBrush(Color.Black), (float) num, (float) ((e.MarginBounds.Height / 10) + 60));
                graphics.DrawLine(Pens.Black, num, (e.MarginBounds.Height / 10) + 90, num + 750, (e.MarginBounds.Height / 10) + 90);
                graphics.DrawLine(Pens.Black, num, (e.MarginBounds.Height / 10) + 120, num + 750, (e.MarginBounds.Height / 10) + 120);
                graphics.DrawString("", font, new SolidBrush(Color.Black), (float) num, (float) ((e.PageBounds.Height / 10) + 60));
                graphics.DrawString("项目名称", font, new SolidBrush(Color.Black), (float) (num + 0x2d), (float) ((e.PageBounds.Height / 10) + 0x4b));
                graphics.DrawString("单位", font, new SolidBrush(Color.Black), (float) (num + 220), (float) ((e.PageBounds.Height / 10) + 0x4b));
                graphics.DrawString("单价", font, new SolidBrush(Color.Black), (float) (num + 290), (float) ((e.PageBounds.Height / 10) + 0x4b));
                graphics.DrawString("数量", font, new SolidBrush(Color.Black), (float) (num + 370), (float) ((e.PageBounds.Height / 10) + 0x4b));
                graphics.DrawString("使用位置明细", font, new SolidBrush(Color.Black), (float) (num + 0x20d), (float) ((e.PageBounds.Height / 10) + 0x4b));
                int num2 = (e.MarginBounds.Height / 10) + 120;
                int num3 = (e.MarginBounds.Height / 10) + 90;
                int num4 = (e.MarginBounds.Height / 10) + 90;
                int num5 = (e.MarginBounds.Height / 10) + 120;
                int num6 = 0;
                for (num7 = 0; num7 < this.tgdvTest.Nodes[0].Nodes.Count; num7++)
                {
                    if (this.tgdvTest.Nodes[0].Nodes[num7].Nodes.Count > 0)
                    {
                        num6 += this.tgdvTest.Nodes[0].Nodes[num7].Nodes.Count;
                    }
                }
                for (int i = 1; i <= num6; i++)
                {
                    num4 = num5 + 5;
                    graphics.DrawString(i.ToString(), font2, new SolidBrush(Color.Black), (float) num, (float) num4);
                    num5 += 30;
                }
                for (num7 = 0; num7 < this.tgdvTest.Nodes[0].Nodes.Count; num7++)
                {
                    for (int j = 0; j < this.tgdvTest.Nodes[0].Nodes[num7].Nodes.Count; j++)
                    {
                        num4 = num2 + 5;
                        graphics.DrawString(this.tgdvTest.Nodes[0].Nodes[num7].Nodes[j].Cells[0].Value.ToString(), font2, new SolidBrush(Color.Black), (float) (num + 0x23), (float) num4);
                        graphics.DrawString(this.tgdvTest.Nodes[0].Nodes[num7].Nodes[j].Cells[1].Value.ToString(), font2, new SolidBrush(Color.Black), (float) (num + 220), (float) num4);
                        graphics.DrawString(this.tgdvTest.Nodes[0].Nodes[num7].Nodes[j].Cells[2].Value.ToString(), font2, new SolidBrush(Color.Black), (float) (num + 290), (float) num4);
                        graphics.DrawString(this.tgdvTest.Nodes[0].Nodes[num7].Nodes[j].Cells[3].Value.ToString(), font2, new SolidBrush(Color.Black), (float) (num + 0x16d), (float) num4);
                        graphics.DrawString(this.tgdvTest.Nodes[0].Nodes[num7].Cells[0].Value.ToString() + "-(" + this.tgdvTest.Nodes[0].Nodes[num7].Nodes[j].Cells[3].Value.ToString() + ")", font2, new SolidBrush(Color.Black), (float) (num + 0x1bd), (float) num4);
                        num2 += 30;
                        graphics.DrawLine(Pens.Black, num, num2, num + 750, num2);
                        graphics.DrawLine(Pens.Black, num, (e.MarginBounds.Height / 10) + 90, num, num2);
                        graphics.DrawLine(Pens.Black, num + 0x23, (e.MarginBounds.Height / 10) + 90, num + 0x23, num2);
                        graphics.DrawLine(Pens.Black, num + 210, (e.MarginBounds.Height / 10) + 90, num + 210, num2);
                        graphics.DrawLine(Pens.Black, num + 280, (e.MarginBounds.Height / 10) + 90, num + 280, num2);
                        graphics.DrawLine(Pens.Black, num + 0x16d, (e.MarginBounds.Height / 10) + 90, num + 0x16d, num2);
                        graphics.DrawLine(Pens.Black, num + 0x1bd, (e.MarginBounds.Height / 10) + 90, num + 0x1bd, num2);
                        graphics.DrawLine(Pens.Black, num + 750, (e.MarginBounds.Height / 10) + 90, num + 750, num2);
                    }
                }
            }
            catch (Exception exception)
            {
                Console.WriteLine(exception.Message);
            }
            graphics.Dispose();
        }

        public void Save_List()
        {
            try
            {
                this.list._BudListKey = "BR" + DateTime.Now.ToString("yyyyMMddHHmmss");
                this.list._BudgetTime = DateTime.Now.Date;
                int num = this.listDB.Add_BudgetList(this.list);
            }
            catch (Exception)
            {
            }
        }

        private void SaveNewBudget()
        {
            jzgl.Windows.BudgetInfo info = new jzgl.Windows.BudgetInfo(budget_id, this.userId);
            info.Owner = this;
            info.ShowDialog();
            info.StartPosition = FormStartPosition.CenterParent;
            if (this.c == 1)
            {
                this.btn_Save.Enabled = true;
                string str = this.save_budget[0].Trim().ToString();
                this.tgdvTest.Nodes[0].Cells[6].Value = this.save_budget[0].Trim().ToString();
                AutoBackDB kdb = new AutoBackDB();
                if (kdb.Show_AutoBackState() == 1)
                {
                    this.autoExportExcel(this.tgdvTest);
                }
                MessageBox.Show(this, "保存成功！", "提示", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
                budget_id = this.save_budget[0];
            }
            else
            {
                this.btn_Save.Enabled = true;
            }
        }

        private bool SaveNewBudget1()
        {
            bool flag = true;
            try
            {
                if (!this.tgvBind())
                {
                    return flag;
                }
                AutoBackDB kdb = new AutoBackDB();
                if (kdb.Show_AutoBackState() == 1)
                {
                    this.autoExportExcel1(this.tgdvTest);
                }
            }
            catch (Exception)
            {
                flag = false;
            }
            return flag;
        }

        private void tbpHouseType_Click(object sender, EventArgs e)
        {
        }

        private void tbpNewBudget_Click(object sender, EventArgs e)
        {
        }

        private void tclHNM_SelectedIndexChanged(object sender, EventArgs e)
        {
        }

        private void textBox1_MouseClick(object sender, MouseEventArgs e)
        {
            this.btn_YuSuan_mingxi.Focus();
        }

        private void textBox1_MouseEnter(object sender, EventArgs e)
        {
            this.btn_YuSuan_mingxi.Focus();
        }

        private void tgdvTest_CellClick(object sender, DataGridViewCellEventArgs e)
        {
            if (this.tgdvTest.CurrentRow.Level != 3)
            {
                this.tgdvTest.CurrentNode.Cells[3].ReadOnly = true;
            }
        }

        private void tgdvTest_CellContentClick(object sender, DataGridViewCellEventArgs e)
        {
        }

        private void tgdvTest_CellDoubleClick(object sender, DataGridViewCellEventArgs e)
        {
            try
            {
                if (this.tgdvTest.CurrentRow.Level == 2)
                {
                    this.splitContainer1.Panel1Collapsed = false;
                    this.splitContainer1.Panel2Collapsed = false;
                    this.er = this.tgdvTest.CurrentNode.Index;
                }
                if (!((this.tgdvTest.CurrentRow.Level != 3) || this.tgdvTest.CurrentNode.Tag.ToString().Trim().Equals("")))
                {
                    this.tgdvTest.CurrentNode.Cells[1].ReadOnly = false;
                    this.tgdvTest.CurrentNode.Cells[2].ReadOnly = false;
                    this.tgdvTest.CurrentNode.Cells[5].ReadOnly = false;
                    this.er2 = this.tgdvTest.CurrentNode.Parent.Index;
                    this.san = this.tgdvTest.CurrentNode.Index;
                    this.fj = 1;
                }
                if ((this.tgdvTest.CurrentRow.Level == 3) && this.tgdvTest.CurrentNode.Tag.ToString().Trim().Equals(""))
                {
                    this.er2 = this.tgdvTest.CurrentNode.Parent.Index;
                    this.san = this.tgdvTest.CurrentNode.Index;
                    this.tgdvTest.CurrentNode.Cells[5].ReadOnly = false;
                    this.bz = 1;
                }
            }
            catch (Exception)
            {
            }
        }

        private void tgdvTest_CellEndEdit(object sender, DataGridViewCellEventArgs e)
        {
            Regex regex;
            Regex regex2;
            try
            {
                if (((this.tgdvTest.CurrentNode.Level == 3) && this.tgdvTest.CurrentNode.Tag.ToString().Trim().Equals("")) && (this.bz == 1))
                {
                    regex = new Regex(@"^\w+$");
                    if (!regex.IsMatch(this.tgdvTest.CurrentNode.Cells[5].Value.ToString().Trim()))
                    {
                    }
                }
            }
            catch (Exception)
            {
                this.tgdvTest.CurrentRow.Cells[5].ReadOnly = false;
                this.tgdvTest.Nodes[0].Nodes[this.er2].Nodes[this.san].Cells[5].Value = "暂无工艺做法说明";
                this.bz = 0;
                return;
            }
            try
            {
                if (((this.tgdvTest.CurrentNode.Level == 3) && this.tgdvTest.CurrentNode.Tag.ToString().Trim().Equals("")) && (this.bz == 1))
                {
                    regex = new Regex(@"^\d+(\.\d+)?$");
                    if (!regex.IsMatch(this.tgdvTest.CurrentNode.Cells[3].Value.ToString().Trim()))
                    {
                        this.tgdvTest.CurrentRow.Cells[3].ReadOnly = false;
                        this.tgdvTest.Nodes[0].Nodes[this.er2].Nodes[this.san].Cells[3].Value = "0.00";
                        this.bz = 0;
                        return;
                    }
                }
            }
            catch (Exception)
            {
                this.tgdvTest.CurrentRow.Cells[3].ReadOnly = false;
                this.tgdvTest.Nodes[0].Nodes[this.er2].Nodes[this.san].Cells[3].Value = "0.00";
                this.bz = 0;
                return;
            }
            try
            {
                if (((this.tgdvTest.CurrentNode.Level == 3) && (this.fj == 1)) && !this.tgdvTest.CurrentNode.Tag.ToString().Trim().Equals(""))
                {
                    regex = new Regex(@"^\w+$");
                    if (!regex.IsMatch(this.tgdvTest.CurrentNode.Cells[0].Value.ToString().Trim()))
                    {
                        this.fj = 0;
                        return;
                    }
                }
            }
            catch (Exception)
            {
                return;
            }
            try
            {
                if (((this.tgdvTest.CurrentNode.Level == 3) && (this.fj == 1)) && !this.tgdvTest.CurrentNode.Tag.ToString().Trim().Equals(""))
                {
                    regex = new Regex(@"^\w+$");
                    if (!regex.IsMatch(this.tgdvTest.CurrentNode.Cells[1].Value.ToString().Trim()))
                    {
                        this.tgdvTest.CurrentRow.Cells[1].ReadOnly = false;
                        this.tgdvTest.Nodes[0].Nodes[this.er2].Nodes[this.san].Cells[1].Value = "暂无单位";
                        this.fj = 0;
                        return;
                    }
                }
            }
            catch (Exception)
            {
                this.tgdvTest.CurrentRow.Cells[1].ReadOnly = false;
                this.tgdvTest.Nodes[0].Nodes[this.er2].Nodes[this.san].Cells[1].Value = "暂无单位";
                this.fj = 0;
                return;
            }
            try
            {
                if (((this.tgdvTest.CurrentNode.Level == 3) && (this.fj == 1)) && !this.tgdvTest.CurrentNode.Tag.ToString().Trim().Equals(""))
                {
                    regex = new Regex(@"^\d+(\.\d+)?$");
                    if (!regex.IsMatch(this.tgdvTest.CurrentNode.Cells[2].Value.ToString().Trim()))
                    {
                        this.tgdvTest.CurrentRow.Cells[2].ReadOnly = false;
                        this.tgdvTest.Nodes[0].Nodes[this.er2].Cells[4].Value = float.Parse(this.tgdvTest.Nodes[0].Nodes[this.er2].Cells[4].Value.ToString().Trim()) - float.Parse(this.tgdvTest.Nodes[0].Nodes[this.er2].Nodes[this.san].Cells[4].Value.ToString().Trim());
                        this.tgdvTest.Nodes[0].Nodes[this.er2].Parent.Cells[4].Value = float.Parse(this.tgdvTest.Nodes[0].Nodes[this.er2].Parent.Cells[4].Value.ToString().Trim()) - float.Parse(this.tgdvTest.Nodes[0].Nodes[this.er2].Nodes[this.san].Cells[4].Value.ToString().Trim());
                        this.tgdvTest.Nodes[0].Nodes[this.er2].Nodes[this.san].Cells[4].Value = "0.00";
                        this.tgdvTest.Nodes[0].Nodes[this.er2].Nodes[this.san].Cells[2].Value = "0.00";
                        this.fj = 0;
                        return;
                    }
                }
            }
            catch (Exception)
            {
                this.tgdvTest.CurrentRow.Cells[2].ReadOnly = false;
                this.tgdvTest.Nodes[0].Nodes[this.er2].Cells[4].Value = float.Parse(this.tgdvTest.Nodes[0].Nodes[this.er2].Cells[4].Value.ToString().Trim()) - float.Parse(this.tgdvTest.Nodes[0].Nodes[this.er2].Nodes[this.san].Cells[4].Value.ToString().Trim());
                this.tgdvTest.Nodes[0].Nodes[this.er2].Parent.Cells[4].Value = float.Parse(this.tgdvTest.Nodes[0].Nodes[this.er2].Parent.Cells[4].Value.ToString().Trim()) - float.Parse(this.tgdvTest.Nodes[0].Nodes[this.er2].Nodes[this.san].Cells[4].Value.ToString().Trim());
                this.tgdvTest.Nodes[0].Nodes[this.er2].Nodes[this.san].Cells[2].Value = "0.00";
                this.tgdvTest.Nodes[0].Nodes[this.er2].Nodes[this.san].Cells[4].Value = "0.00";
                this.fj = 0;
                return;
            }
            try
            {
                if (((this.tgdvTest.CurrentNode.Level == 3) && (this.fj == 1)) && !this.tgdvTest.CurrentNode.Tag.ToString().Trim().Equals(""))
                {
                    regex = new Regex(@"^\d+(\.\d+)?$");
                    if (!regex.IsMatch(this.tgdvTest.CurrentNode.Cells[3].Value.ToString().Trim()))
                    {
                        this.tgdvTest.CurrentRow.Cells[2].ReadOnly = false;
                        this.tgdvTest.Nodes[0].Nodes[this.er2].Cells[4].Value = float.Parse(this.tgdvTest.Nodes[0].Nodes[this.er2].Cells[4].Value.ToString().Trim()) - float.Parse(this.tgdvTest.Nodes[0].Nodes[this.er2].Nodes[this.san].Cells[4].Value.ToString().Trim());
                        this.tgdvTest.Nodes[0].Nodes[this.er2].Parent.Cells[4].Value = float.Parse(this.tgdvTest.Nodes[0].Nodes[this.er2].Parent.Cells[4].Value.ToString().Trim()) - float.Parse(this.tgdvTest.Nodes[0].Nodes[this.er2].Nodes[this.san].Cells[4].Value.ToString().Trim());
                        this.tgdvTest.Nodes[0].Nodes[this.er2].Nodes[this.san].Cells[4].Value = "0.00";
                        this.tgdvTest.Nodes[0].Nodes[this.er2].Nodes[this.san].Cells[3].Value = "0.00";
                        this.fj = 0;
                        return;
                    }
                }
            }
            catch (Exception)
            {
                this.tgdvTest.CurrentRow.Cells[2].ReadOnly = false;
                this.tgdvTest.Nodes[0].Nodes[this.er2].Cells[4].Value = float.Parse(this.tgdvTest.Nodes[0].Nodes[this.er2].Cells[4].Value.ToString().Trim()) - float.Parse(this.tgdvTest.Nodes[0].Nodes[this.er2].Nodes[this.san].Cells[4].Value.ToString().Trim());
                this.tgdvTest.Nodes[0].Nodes[this.er2].Parent.Cells[4].Value = float.Parse(this.tgdvTest.Nodes[0].Nodes[this.er2].Parent.Cells[4].Value.ToString().Trim()) - float.Parse(this.tgdvTest.Nodes[0].Nodes[this.er2].Nodes[this.san].Cells[4].Value.ToString().Trim());
                this.tgdvTest.Nodes[0].Nodes[this.er2].Nodes[this.san].Cells[4].Value = "0.00";
                this.tgdvTest.Nodes[0].Nodes[this.er2].Nodes[this.san].Cells[3].Value = "0.00";
            }
            try
            {
                if (((this.tgdvTest.CurrentNode.Level == 3) && (this.fj == 1)) && !this.tgdvTest.CurrentNode.Tag.ToString().Trim().Equals(""))
                {
                    regex = new Regex(@"^\d+(\.\d+)?$");
                    if (!regex.IsMatch(this.tgdvTest.CurrentNode.Cells[4].Value.ToString().Trim()))
                    {
                        this.tgdvTest.CurrentRow.Cells[4].ReadOnly = false;
                        this.tgdvTest.Nodes[0].Nodes[this.er2].Nodes[this.san].Cells[4].Value = "0.00";
                        this.fj = 0;
                        return;
                    }
                }
            }
            catch (Exception)
            {
                this.tgdvTest.CurrentRow.Cells[4].ReadOnly = false;
                this.tgdvTest.Nodes[0].Nodes[this.er2].Nodes[this.san].Cells[4].Value = "0.00";
                this.fj = 0;
                return;
            }
            try
            {
                if (((this.tgdvTest.CurrentNode.Level == 3) && (this.fj == 1)) && !this.tgdvTest.CurrentNode.Tag.ToString().Trim().Equals(""))
                {
                    regex = new Regex(@"^\w+$");
                    if (!regex.IsMatch(this.tgdvTest.CurrentNode.Cells[5].Value.ToString().Trim()))
                    {
                    }
                }
            }
            catch (Exception)
            {
                this.tgdvTest.CurrentRow.Cells[5].ReadOnly = false;
                this.tgdvTest.Nodes[0].Nodes[this.er2].Nodes[this.san].Cells[5].Value = "暂无工艺做法说明";
                this.fj = 0;
                return;
            }
            try
            {
                if (this.tgdvTest.CurrentNode.Level == 3)
                {
                    this.item_money = 0f;
                    this.total_money = 0f;
                    regex2 = new Regex(@"^\d{1,}$");
                    Regex regex3 = new Regex(@"^\d+(\.\d+)?$");
                    if (regex3.IsMatch(this.tgdvTest.CurrentRow.Cells[3].Value.ToString().Trim()))
                    {
                        this.tgdvTest.CurrentRow.Cells[3].Value = float.Parse(this.tgdvTest.CurrentRow.Cells[3].Value.ToString().Trim());
                        if (regex3.IsMatch(this.tgdvTest.CurrentRow.Cells[2].Value.ToString().Trim()))
                        {
                            int num2;
                            this.tgdvTest.CurrentRow.Cells[3].ReadOnly = false;
                            float num = float.Parse(this.tgdvTest.CurrentRow.Cells[2].Value.ToString().Trim()) * float.Parse(this.tgdvTest.CurrentRow.Cells[3].Value.ToString().Trim());
                            this.tgdvTest.CurrentRow.Cells[4].Value = num;
                            for (num2 = 0; num2 < this.tgdvTest.CurrentRow.Parent.Nodes.Count; num2++)
                            {
                                this.item_money += float.Parse(this.tgdvTest.CurrentRow.Parent.Nodes[num2].Cells[4].Value.ToString());
                                this.tgdvTest.CurrentRow.Parent.Cells[4].Value = this.item_money;
                                this.tgdvTest.CurrentRow.Parent.Cells[4].Style.ForeColor = Color.Blue;
                            }
                            for (num2 = 0; num2 < this.tgdvTest.CurrentRow.Parent.Parent.Nodes.Count; num2++)
                            {
                                this.total_money += float.Parse(this.tgdvTest.CurrentRow.Parent.Parent.Nodes[num2].Cells[4].Value.ToString());
                                this.tgdvTest.CurrentRow.Parent.Parent.Cells[4].Value = this.total_money;
                                this.tgdvTest.CurrentRow.Parent.Parent.Cells[4].Style.ForeColor = Color.Red;
                            }
                            goto Label_17EA;
                        }
                        MessageBox.Show("请正确输入单价！", "提示", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
                        this.tgdvTest.CurrentRow.Parent.Cells[4].Value = float.Parse(this.tgdvTest.CurrentRow.Parent.Cells[4].Value.ToString().Trim()) - float.Parse(this.tgdvTest.CurrentRow.Cells[4].Value.ToString().Trim());
                        this.tgdvTest.CurrentRow.Parent.Parent.Cells[4].Value = float.Parse(this.tgdvTest.CurrentRow.Parent.Parent.Cells[4].Value.ToString().Trim()) - float.Parse(this.tgdvTest.CurrentRow.Cells[4].Value.ToString().Trim());
                        this.tgdvTest.CurrentRow.Cells[4].Value = "0.00";
                        this.tgdvTest.CurrentRow.Cells[3].Value = "0.00";
                    }
                    else
                    {
                        MessageBox.Show("请正确输入数量！", "提示", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
                        this.tgdvTest.CurrentRow.Parent.Cells[4].Value = float.Parse(this.tgdvTest.CurrentRow.Parent.Cells[4].Value.ToString().Trim()) - float.Parse(this.tgdvTest.CurrentRow.Cells[4].Value.ToString().Trim());
                        this.tgdvTest.CurrentRow.Parent.Parent.Cells[4].Value = float.Parse(this.tgdvTest.CurrentRow.Parent.Parent.Cells[4].Value.ToString().Trim()) - float.Parse(this.tgdvTest.CurrentRow.Cells[4].Value.ToString().Trim());
                        this.tgdvTest.CurrentRow.Cells[4].Value = "0.00";
                        this.tgdvTest.CurrentRow.Cells[3].Value = "0.00";
                    }
                    return;
                }
                this.tgdvTest.CurrentRow.Cells[3].ReadOnly = true;
            }
            catch (Exception)
            {
                MessageBox.Show("数量或者价格输入错误，请正确输入！", "提示", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
                this.tgdvTest.CurrentCell.Value = "0.00";
                return;
            }
        Label_17EA:;
            try
            {
                if (this.tgdvTest.CurrentNode.Level == 2)
                {
                    regex2 = new Regex(@"^\w+$");
                    if (regex2.IsMatch(this.tgdvTest.CurrentNode.Cells[0].Value.ToString().Trim()))
                    {
                        this.tgdvTest.CurrentNode.Cells[0].ReadOnly = true;
                    }
                    else
                    {
                        this.er_a = 1;
                        this.tgdvTest.CurrentNode.Cells[0].ReadOnly = false;
                    }
                }
            }
            catch (Exception)
            {
                this.er_a = 1;
                this.tgdvTest.CurrentNode.Cells[0].ReadOnly = false;
            }
        }

        private void tgdvTest_CellEnter(object sender, DataGridViewCellEventArgs e)
        {
            if (this.tgdvTest.CurrentRow.Level != 3)
            {
                this.tgdvTest.CurrentNode.Cells[3].ReadOnly = true;
            }
        }

        private void tgdvTest_MouseDown(object sender, MouseEventArgs e)
        {
            if (e.Button == MouseButtons.Right)
            {
                mouseState = this.tgdvTest.HitTest(e.X, e.Y).RowIndex;
            }
        }

        private void tgdvTest_RowLeave(object sender, DataGridViewCellEventArgs e)
        {
            if (this.tgdvTest.CurrentNode.Level == 3)
            {
                this.tgdvTest.CurrentNode.Cells[0].ReadOnly = true;
                this.tgdvTest.CurrentNode.Cells[1].ReadOnly = true;
                this.tgdvTest.CurrentNode.Cells[2].ReadOnly = true;
                this.tgdvTest.CurrentNode.Cells[5].ReadOnly = true;
            }
        }

        public void tgv_Bind(string listId)
        {
            this.tgdvTest.Nodes.Clear();
            this.table = this.listDB.Show_BudgetListBy_BudlistId(listId);
            System.Data.DataTable table = this.infoDB.Show_BudgetInfoBYBudgetList_Key(listId);
            System.Data.DataTable table2 = null;
            System.Data.DataTable table3 = this.barDB.Show_BudgetBargainBy_BudgetId(listId);
            this.tclHNM.SelectedTab = this.tbpNewBudget;
            this.lbl_HuXing.Text = this.table.Rows[0][6].ToString();
            System.Drawing.Font font = new System.Drawing.Font(this.tgdvTest.DefaultCellStyle.Font, FontStyle.Bold);
            TreeGridNode node = this.tgdvTest.Nodes.Add(new object[] { "总计", "", "", "", double.Parse(table3.Rows[0][7].ToString()), "", "'" + this.treeView1.SelectedNode.Tag.ToString().Trim() });
            node.ImageIndex = 1;
            node.Cells[4].Style.ForeColor = Color.Red;
            node.Cells[0].Style.BackColor = Color.Gray;
            node.Cells[1].Style.BackColor = Color.Gray;
            node.Cells[2].Style.BackColor = Color.Gray;
            node.Cells[3].Style.BackColor = Color.Gray;
            node.Cells[4].Style.BackColor = Color.Gray;
            node.Cells[5].Style.BackColor = Color.Gray;
            node.Cells[6].Style.BackColor = Color.Gray;
            node.DefaultCellStyle.Font = font;
            for (int i = 0; i < table.Rows.Count; i++)
            {
                TreeGridNode node2 = node.Nodes.Add(new object[] { table.Rows[i][2].ToString().Trim(), "", "", "", double.Parse(table.Rows[i][3].ToString().Trim()), "", "'" + i.ToString() });
                node2.ImageIndex = 2;
                node2.Cells[4].Style.ForeColor = Color.Blue;
                node2.Cells[0].Style.BackColor = Color.LightGray;
                node2.Cells[1].Style.BackColor = Color.LightGray;
                node2.Cells[2].Style.BackColor = Color.LightGray;
                node2.Cells[3].Style.BackColor = Color.LightGray;
                node2.Cells[4].Style.BackColor = Color.LightGray;
                node2.Cells[5].Style.BackColor = Color.LightGray;
                node2.Cells[6].Style.BackColor = Color.LightGray;
                table2 = this.detailsDB.Show_BudgetDetailsYBudInfo_Id(table.Rows[i][1].ToString().Trim(), listId);
                for (int j = 0; j < table2.Rows.Count; j++)
                {
                    TreeGridNode node3 = node2.Nodes.Add(new object[] { table2.Rows[j][3].ToString().Trim(), table2.Rows[j][4].ToString().Trim(), double.Parse(table2.Rows[j][5].ToString().Trim()), double.Parse(table2.Rows[j][6].ToString().Trim()), double.Parse(table2.Rows[j][7].ToString().Trim()), table2.Rows[j][8].ToString().Trim(), "" });
                    node3.ImageIndex = 0;
                    node3.Tag = "";
                    node3.Cells[5].ReadOnly = false;
                }
            }
            node.Expand();
        }

        public bool tgvBind()
        {
            bool flag = true;
            string path = string.Format("NewBudgetBackup/{0}_{1}.xls", this.userId, this.FileNodeName);
            try
            {
                if (!File.Exists(path))
                {
                    return flag;
                }
                int second = DateTime.Now.Date.Second;
                DataSet set = null;
                System.Drawing.Font font = new System.Drawing.Font(this.tgdvTest.DefaultCellStyle.Font, FontStyle.Bold);
                set = ConnDB.ExcelToDSBy_FileName(path, string.Format("{0}_{1}.xls", this.userId, this.FileNodeName));
                if (set == null)
                {
                    return flag;
                }
                if (set.Tables[0].Rows.Count <= 0)
                {
                    return flag;
                }
                System.Data.DataTable table = set.Tables[0];
                if (table.Columns.Count < 6)
                {
                    return flag;
                }
                TreeGridNode node = new TreeGridNode();
                TreeGridNode node2 = new TreeGridNode();
                int num3 = 0;
                this.lbl_HuXing.Text = table.Rows[1][5].ToString().Trim();
                budget_id = this.Auto_save_budget[0];
                TreeGridNode node3 = this.tgdvTest.Nodes.Add(new object[] { "总计", "", "", "", double.Parse(table.Rows[1][4].ToString().Trim()).ToString("f2"), "", this.Auto_save_budget[0] });
                budget_id = table.Rows[1][6].ToString().Trim();
                this.lblCustomer.Text = table.Rows[1][1].ToString().Trim();
                if (table.Rows[1][4].ToString().Trim().Equals(""))
                {
                    this.lbl_HuXing.Text = table.Rows[1][5].ToString().Trim();
                }
                node3.ImageIndex = 1;
                node3.DefaultCellStyle.Font = font;
                node3.Cells[4].Style.ForeColor = Color.Red;
                node3.Cells[0].Style.BackColor = Color.Gray;
                node3.Cells[1].Style.BackColor = Color.Gray;
                node3.Cells[2].Style.BackColor = Color.Gray;
                node3.Cells[3].Style.BackColor = Color.Gray;
                node3.Cells[4].Style.BackColor = Color.Gray;
                node3.Cells[5].Style.BackColor = Color.Gray;
                node3.Cells[6].Style.BackColor = Color.Gray;
                for (int i = 2; i < (table.Rows.Count - 1); i++)
                {
                    if (!table.Rows[i][6].ToString().Trim().Equals(""))
                    {
                        node = node3.Nodes.Add(new object[] { table.Rows[i][0].ToString().Trim(), "", "", "", double.Parse(table.Rows[i][4].ToString().Trim()).ToString("f2"), "", num3 });
                        node.ImageIndex = 2;
                        node.Cells[4].Style.ForeColor = Color.Blue;
                        node.Cells[0].Style.BackColor = Color.LightGray;
                        node.Cells[1].Style.BackColor = Color.LightGray;
                        node.Cells[2].Style.BackColor = Color.LightGray;
                        node.Cells[3].Style.BackColor = Color.LightGray;
                        node.Cells[4].Style.BackColor = Color.LightGray;
                        node.Cells[5].Style.BackColor = Color.LightGray;
                        node.Cells[6].Style.BackColor = Color.LightGray;
                        num3++;
                    }
                    else
                    {
                        try
                        {
                            node2 = node.Nodes.Add(new object[] { table.Rows[i][0].ToString().Trim(), table.Rows[i][1].ToString().Trim(), double.Parse(table.Rows[i][2].ToString().Trim()).ToString("f2"), double.Parse(table.Rows[i][3].ToString().Trim()).ToString("f2"), double.Parse(table.Rows[i][4].ToString().Trim()).ToString("f2"), table.Rows[i][5].ToString().Trim(), "" });
                            node2.ImageIndex = 0;
                            node2.Tag = "";
                            num3++;
                        }
                        catch (Exception exception)
                        {
                            MessageBox.Show(exception.Message);
                        }
                    }
                }
                this.tgdvTest.Nodes[0].Expand();
                this.table = this.listDB.Show_BudgetListBy_BudlistId(budget_id);
                if (this.table.Rows.Count > 0)
                {
                    this.lblCustomerName.Text = this.table.Rows[0][2].ToString();
                    this.lblCustomerPhone.Text = this.table.Rows[0][3].ToString();
                    this.lbl_designer.Text = this.table.Rows[0][4].ToString();
                    this.lblProAddress.Text = this.table.Rows[0][12].ToString();
                }
            }
            catch (Exception)
            {
                flag = false;
            }
            return flag;
        }

        private void treeView1_AfterSelect(object sender, TreeViewEventArgs e)
        {
            try
            {
                if (this.treeView1.SelectedNode.Level == 2)
                {
                    this.oldkey = this.treeView1.SelectedNode.Tag.ToString();
                    this.FileNodeName = this.treeView1.SelectedNode.Text.ToString();
                    this.table = this.listDB.Show_BudgetListBy_BudlistId(this.treeView1.SelectedNode.Tag.ToString());
                    if (this.table.Rows.Count != 0)
                    {
                        this.lblProAddress.Text = this.lbl_address.Text = this.table.Rows[0][12].ToString();
                        this.lbl_area.Text = this.table.Rows[0][7].ToString();
                        this.lblCustomerName.Text = this.lbl_custname.Text = this.table.Rows[0][2].ToString();
                        this.lblDesigner.Text = this.lbl_designer.Text = this.table.Rows[0][4].ToString();
                        this.lbl_housetype.Text = this.table.Rows[0][6].ToString();
                        this.lblCustomerPhone.Text = this.lbl_phone.Text = this.table.Rows[0][3].ToString();
                        this.lbl_style.Text = this.table.Rows[0][8].ToString();
                        this.lbl_Qiandan_date.Text = "";
                        this.lbl_GongChang.Text = "";
                        this.lbl_ShiGong_date.Text = "";
                        this.lbl_YuSuan.Text = "￥" + float.Parse(this.table.Rows[0][14].ToString()).ToString("f2").ToString();
                        DesPicDB cdb = new DesPicDB();
                        this.lbl_SheJiTu.Text = "共 " + cdb.Count_Pic(this.treeView1.SelectedNode.Tag.ToString()) + " 张";
                    }
                    System.Data.DataTable table = this.barDB.Show_BudgetBargainBy_BudgetId(this.treeView1.SelectedNode.Tag.ToString());
                    if (table.Rows.Count != 0)
                    {
                        this.textBox1.Text = table.Rows[0][12].ToString();
                        if (table.Rows[0][4].ToString().Trim().Equals("1"))
                        {
                            this.lbl_ShiGong_date.Text = DateTime.Parse(this.table.Rows[0][10].ToString()).ToShortDateString();
                            this.lbl_Qiandan_date.Text = DateTime.Parse(table.Rows[0][3].ToString()).ToShortDateString();
                            this.lbl_GongChang.Text = DateTime.Parse(table.Rows[0][9].ToString()).ToShortDateString() + " 至 " + DateTime.Parse(table.Rows[0][10].ToString()).ToShortDateString();
                            this.lbl_HeTong_price.Text = "￥" + float.Parse(table.Rows[0][7].ToString()).ToString("f2").ToString();
                        }
                        else
                        {
                            this.lbl_HeTong_price.Text = "";
                        }
                    }
                }
                else
                {
                    this.lbl_address.Text = "";
                    this.lbl_area.Text = "";
                    this.textBox1.Text = "";
                    this.lbl_custname.Text = "";
                    this.lbl_designer.Text = "";
                    this.lbl_GongChang.Text = "";
                    this.lbl_HeTong_price.Text = "";
                    this.lbl_housetype.Text = "";
                    this.lbl_HuXing.Text = "";
                    this.lbl_phone.Text = "";
                    this.lbl_Qiandan_date.Text = "";
                    this.lbl_SheJiTu.Text = "共 0 张";
                    this.lbl_ShiGong_date.Text = "";
                    this.lbl_style.Text = "";
                    this.lbl_YuSuan.Text = "￥0.00";
                }
            }
            catch (Exception)
            {
            }
        }

        private void txt_chufang_KeyPress(object sender, KeyPressEventArgs e)
        {
            e.Handled = (e.KeyChar < '0') || (e.KeyChar > '9');
            if (e.KeyChar == '\b')
            {
                e.Handled = false;
            }
            if (e.Handled)
            {
                MessageBox.Show(this, "请输入数字！", "提示", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
            }
        }

        private void txt_chuwujian_KeyPress(object sender, KeyPressEventArgs e)
        {
            e.Handled = (e.KeyChar < '0') || (e.KeyChar > '9');
            if (e.KeyChar == '\b')
            {
                e.Handled = false;
            }
            if (e.Handled)
            {
                MessageBox.Show(this, "请输入数字！", "提示", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
            }
        }

        private void txt_guodao_KeyPress(object sender, KeyPressEventArgs e)
        {
            e.Handled = (e.KeyChar < '0') || (e.KeyChar > '9');
            if (e.KeyChar == '\b')
            {
                e.Handled = false;
            }
            if (e.Handled)
            {
                MessageBox.Show(this, "请输入数字！", "提示", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
            }
        }

        private void txt_louti_KeyPress(object sender, KeyPressEventArgs e)
        {
            e.Handled = (e.KeyChar < '0') || (e.KeyChar > '9');
            if (e.KeyChar == '\b')
            {
                e.Handled = false;
            }
            if (e.Handled)
            {
                MessageBox.Show(this, "请输入数字！", "提示", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
            }
        }

        private void txt_qita_KeyPress(object sender, KeyPressEventArgs e)
        {
            e.Handled = (e.KeyChar < '0') || (e.KeyChar > '9');
            if (e.KeyChar == '\b')
            {
                e.Handled = false;
            }
            if (e.Handled)
            {
                MessageBox.Show(this, "请输入数字！", "提示", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
            }
        }

        private void txt_shi_KeyPress(object sender, KeyPressEventArgs e)
        {
            e.Handled = (e.KeyChar < '0') || (e.KeyChar > '9');
            if (e.KeyChar == '\b')
            {
                e.Handled = false;
            }
            if (e.Handled)
            {
                MessageBox.Show(this, "请输入数字！", "提示", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
            }
        }

        private void txt_shuidian_KeyPress(object sender, KeyPressEventArgs e)
        {
            e.Handled = (e.KeyChar < '0') || (e.KeyChar > '9');
            if (e.KeyChar == '\b')
            {
                e.Handled = false;
            }
            if (e.Handled)
            {
                MessageBox.Show(this, "请输入数字！", "提示", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
            }
        }

        private void txt_ting_KeyPress(object sender, KeyPressEventArgs e)
        {
            e.Handled = (e.KeyChar < '0') || (e.KeyChar > '9');
            if (e.KeyChar == '\b')
            {
                e.Handled = false;
            }
            if (e.Handled)
            {
                MessageBox.Show(this, "请输入数字！", "提示", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
            }
        }

        private void txt_wei_KeyPress(object sender, KeyPressEventArgs e)
        {
            e.Handled = (e.KeyChar < '0') || (e.KeyChar > '9');
            if (e.KeyChar == '\b')
            {
                e.Handled = false;
            }
            if (e.Handled)
            {
                MessageBox.Show(this, "请输入数字！", "提示", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
            }
        }

        private void txt_xuanguan_KeyPress(object sender, KeyPressEventArgs e)
        {
            e.Handled = (e.KeyChar < '0') || (e.KeyChar > '9');
            if (e.KeyChar == '\b')
            {
                e.Handled = false;
            }
            if (e.Handled)
            {
                MessageBox.Show(this, "请输入数字！", "提示", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
            }
        }

        private void txt_yangtai_KeyPress(object sender, KeyPressEventArgs e)
        {
            e.Handled = (e.KeyChar < '0') || (e.KeyChar > '9');
            if (e.KeyChar == '\b')
            {
                e.Handled = false;
            }
            if (e.Handled)
            {
                MessageBox.Show(this, "请输入数字！", "提示", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
            }
        }

        private void 附加项目ToolStripMenuItem_Click(object sender, EventArgs e)
        {
            if (this.tgdvTest.CurrentNode.Level == 2)
            {
                int num = 0;
                for (int i = 0; i < this.save_sore.Count; i++)
                {
                    if (this.tgdvTest.CurrentNode.Index > this.save_sore[i])
                    {
                        num++;
                    }
                }
                int num3 = this.tgdvTest.CurrentNode.Index - num;
                Append_Info info = new Append_Info();
                info.Owner = this;
                info.ShowDialog();
                if (!this.item[0].Trim().Equals(""))
                {
                    if (this.tgdvTest.CurrentNode.Nodes.Count == 0)
                    {
                        TreeGridNode node;
                        if (this.item[3].Trim().Equals(""))
                        {
                            node = this.tgdvTest.CurrentNode.Nodes.Add(new object[] { this.item[0], this.item[1], double.Parse(this.item[2]).ToString("f2"), "0.00", "0.00", "暂无工艺做法说明", "" });
                            node.ImageIndex = 0;
                            node.Tag = "fj";
                            this.tgdvTest.CurrentNode.Expand();
                        }
                        else
                        {
                            node = this.tgdvTest.CurrentNode.Nodes.Add(new object[] { this.item[0], this.item[1], double.Parse(this.item[2]).ToString("f2"), "0.00", "0.00", this.item[3], "" });
                            node.ImageIndex = 0;
                            node.Tag = "fj";
                            this.tgdvTest.CurrentNode.Expand();
                        }
                    }
                    else
                    {
                        int num4;
                        List<MaterInfo> list = new List<MaterInfo>();
                        for (num4 = 0; num4 < this.tgdvTest.CurrentNode.Nodes.Count; num4++)
                        {
                            MaterInfo info2 = new MaterInfo();
                            info2._MaterInfoName = this.tgdvTest.CurrentNode.Nodes[num4].Cells[0].Value.ToString();
                            info2._MaterUnit = this.tgdvTest.CurrentNode.Nodes[num4].Cells[1].Value.ToString();
                            info2._MaterPrice = this.tgdvTest.CurrentNode.Nodes[num4].Cells[2].Value.ToString();
                            info2.Num = this.tgdvTest.CurrentNode.Nodes[num4].Cells[3].Value.ToString();
                            info2.TotalPrice = this.tgdvTest.CurrentNode.Nodes[num4].Cells[4].Value.ToString();
                            info2._MaterTech = this.tgdvTest.CurrentNode.Nodes[num4].Cells[5].Value.ToString();
                            info2._MaterRemark = this.tgdvTest.CurrentNode.Nodes[num4].Tag.ToString();
                            list.Add(info2);
                        }
                        MaterInfo item = new MaterInfo();
                        item._MaterInfoName = this.item[0];
                        item._MaterUnit = this.item[1];
                        item._MaterPrice = this.item[2];
                        item.Num = "0.00";
                        item.TotalPrice = "0.00";
                        item._MaterTech = this.item[3];
                        item._MaterRemark = "fj";
                        int count = this.tgdvTest.CurrentNode.Nodes.Count;
                        list.Insert(count, item);
                        this.tgdvTest.CurrentNode.Nodes.Clear();
                        for (num4 = 0; num4 < list.Count; num4++)
                        {
                            TreeGridNode node2;
                            MaterInfo info4 = list[num4];
                            if (info4._MaterTech.ToString().Trim().Equals("") && info4._MaterRemark.Trim().Contains("fj"))
                            {
                                node2 = this.tgdvTest.Nodes[0].Nodes[num3].Nodes.Add(new object[] { info4._MaterInfoName, info4._MaterUnit, info4._MaterPrice, info4.Num, info4.TotalPrice, "暂无工艺做法说明", "" });
                                node2.ImageIndex = 0;
                                node2.Tag = info4._MaterRemark;
                                if (info4._MaterRemark.Trim().Equals(""))
                                {
                                    node2.Tag = info4._MaterRemark;
                                    node2.Cells[0].ReadOnly = true;
                                    node2.Cells[1].ReadOnly = true;
                                    node2.Cells[2].ReadOnly = true;
                                    node2.Cells[5].ReadOnly = true;
                                }
                            }
                            else
                            {
                                node2 = this.tgdvTest.Nodes[0].Nodes[num3].Nodes.Add(new object[] { info4._MaterInfoName, info4._MaterUnit, info4._MaterPrice, info4.Num, info4.TotalPrice, info4._MaterTech, "" });
                                node2.ImageIndex = 0;
                                node2.Tag = info4._MaterRemark;
                                if (info4._MaterRemark.Trim().Equals(""))
                                {
                                    node2.Tag = info4._MaterRemark;
                                    node2.Cells[0].ReadOnly = true;
                                    node2.Cells[1].ReadOnly = true;
                                    node2.Cells[2].ReadOnly = true;
                                    node2.Cells[5].ReadOnly = true;
                                }
                            }
                        }
                    }
                }
            }
        }

        private void 复制单元项目ToolStripMenuItem_Click(object sender, EventArgs e)
        {
            if (this.tgdvTest.CurrentNode.Level == 2)
            {
                this.copy[0] = "";
                this.copy[1] = "";
                this.copy[2] = "";
                this.copy[3] = "";
                this.copy[4] = "";
                this.copy[5] = "";
                this.copy[6] = "";
                this.copy[7] = "";
                this.materList = new List<MaterInfo>();
                int count = this.tgdvTest.CurrentNode.Nodes.Count;
                for (int i = 0; i < count; i++)
                {
                    MaterInfo item = new MaterInfo();
                    item._MaterInfoName = this.tgdvTest.CurrentNode.Nodes[i].Cells[0].Value.ToString();
                    item._MaterUnit = this.tgdvTest.CurrentNode.Nodes[i].Cells[1].Value.ToString();
                    item._MaterPrice = this.tgdvTest.CurrentNode.Nodes[i].Cells[2].Value.ToString();
                    item.Num = this.tgdvTest.CurrentNode.Nodes[i].Cells[3].Value.ToString();
                    item.TotalPrice = this.tgdvTest.CurrentNode.Nodes[i].Cells[4].Value.ToString();
                    item._MaterTech = this.tgdvTest.CurrentNode.Nodes[i].Cells[5].Value.ToString();
                    item._MaterRemark = this.tgdvTest.CurrentNode.Nodes[i].Tag.ToString();
                    this.materList.Add(item);
                }
            }
            if (this.tgdvTest.CurrentNode.Level == 3)
            {
                this.materList = null;
                this.copy[0] = this.tgdvTest.CurrentNode.Cells[0].Value.ToString();
                this.copy[1] = this.tgdvTest.CurrentNode.Cells[1].Value.ToString();
                this.copy[2] = this.tgdvTest.CurrentNode.Cells[2].Value.ToString();
                this.copy[3] = this.tgdvTest.CurrentNode.Cells[3].Value.ToString();
                this.copy[4] = this.tgdvTest.CurrentNode.Cells[4].Value.ToString();
                this.copy[5] = this.tgdvTest.CurrentNode.Cells[5].Value.ToString();
                if (!this.tgdvTest.CurrentNode.Tag.ToString().Equals(""))
                {
                    this.copy[7] = this.tgdvTest.CurrentNode.Tag.ToString().Trim();
                    this.fj_index = this.tgdvTest.CurrentNode.Cells[0].Value.ToString();
                }
                else
                {
                    this.copy[7] = "";
                }
            }
        }

        private void 删除施工单元ToolStripMenuItem_Click(object sender, EventArgs e)
        {
            int num4;
            int index = 0;
            int num2 = 0;
            if (this.tgdvTest.CurrentNode.Level == 3)
            {
                int num3 = 0;
                for (num4 = 0; num4 < this.save_sore.Count; num4++)
                {
                    if (this.tgdvTest.CurrentNode.Parent.Index > this.save_sore[num4])
                    {
                        num3++;
                    }
                }
                index = this.tgdvTest.CurrentNode.Index;
                num2 = this.tgdvTest.Nodes[0].Nodes[this.tgdvTest.CurrentNode.Parent.Index - num3].Nodes.Count - 1;
            }
            List<wlInfo> list = new List<wlInfo>();
            try
            {
                if (MessageBox.Show("确定要删除吗？", "确认", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
                {
                    float num9;
                    int num5 = 0;
                    int num6 = 0;
                    int num7 = 0;
                    if (this.tgdvTest.CurrentNode.Level != 3)
                    {
                        this.save_sore.Add(this.tgdvTest.CurrentNode.Index);
                    }
                    if (this.tgdvTest.CurrentNode.Level == 3)
                    {
                        this.save_score1.Add(this.tgdvTest.CurrentNode.Index);
                    }
                    if (this.tgdvTest.CurrentNode.Level == 3)
                    {
                        num6 = this.tgdvTest.CurrentNode.Index;
                        num7 = this.tgdvTest.CurrentNode.Parent.Index;
                        for (num4 = 0; num4 < this.tgdvTest.CurrentNode.Parent.Nodes.Count; num4++)
                        {
                            wlInfo item = new wlInfo();
                            item.proName = Convert.ToString(this.tgdvTest.CurrentNode.Parent.Nodes[num4].Cells[0].Value);
                            item.danWei = Convert.ToString(this.tgdvTest.CurrentNode.Parent.Nodes[num4].Cells[1].Value);
                            item.price = Convert.ToDouble(this.tgdvTest.CurrentNode.Parent.Nodes[num4].Cells[2].Value);
                            string str = Convert.ToString(this.tgdvTest.CurrentNode.Parent.Nodes[num4].Cells[3].Value);
                            item.num = Convert.ToDouble(str);
                            item.priceCount = Convert.ToDouble(this.tgdvTest.CurrentNode.Parent.Nodes[num4].Cells[4].Value);
                            item.GYdo = Convert.ToString(this.tgdvTest.CurrentNode.Parent.Nodes[num4].Cells[5].Value);
                            list.Add(item);
                        }
                    }
                    if (this.tgdvTest.CurrentNode.Level == 2)
                    {
                        if (this.tgdvTest.Nodes[0].Nodes.Count == 1)
                        {
                            MessageBox.Show("预算必须至少含有一项施工项目！", "提示", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
                            return;
                        }
                        if (this.tgdvTest.CurrentNode.Nodes.Count > 0)
                        {
                            for (int i = 0; i < this.tgdvTest.CurrentNode.Nodes.Count; i++)
                            {
                                this.tgdvTest.CurrentNode.Nodes.RemoveAt(i);
                            }
                            num9 = float.Parse(this.tgdvTest.Nodes[0].Cells[4].Value.ToString().Trim()) - float.Parse(this.tgdvTest.CurrentNode.Cells[4].Value.ToString().Trim());
                            this.tgdvTest.Nodes[0].Cells[4].Value = num9;
                            this.tgdvTest.Nodes[0].Nodes.Remove(this.tgdvTest.CurrentNode);
                            if (this.tgdvTest.CurrentNode.Index != (this.s - 1))
                            {
                                this.delCount++;
                            }
                            this.AddNO = 0;
                        }
                        else
                        {
                            if (this.tgdvTest.CurrentNode.Index != (this.s - 1))
                            {
                                this.delCount++;
                            }
                            this.AddNO = 0;
                            this.tgdvTest.Nodes[0].Nodes.Remove(this.tgdvTest.CurrentNode);
                        }
                        num5 = 1;
                    }
                    int num10 = 0;
                    if ((this.tgdvTest.CurrentNode.Level == 3) && (num5 == 0))
                    {
                        float num11 = float.Parse(this.tgdvTest.CurrentNode.Parent.Cells[4].Value.ToString().Trim()) - float.Parse(this.tgdvTest.CurrentNode.Cells[4].Value.ToString().Trim());
                        this.tgdvTest.CurrentNode.Parent.Cells[4].Value = num11;
                        num9 = float.Parse(this.tgdvTest.Nodes[0].Cells[4].Value.ToString().Trim()) - float.Parse(this.tgdvTest.CurrentNode.Cells[4].Value.ToString().Trim());
                        this.tgdvTest.Nodes[0].Cells[4].Value = num9;
                        for (int j = 0; j < this.save_sore.Count; j++)
                        {
                            if (this.tgdvTest.CurrentNode.Parent.Index > this.save_sore[j])
                            {
                                num10++;
                            }
                        }
                        this.tgdvTest.Nodes[0].Nodes[this.tgdvTest.CurrentNode.Parent.Index - num10].Nodes.Remove(this.tgdvTest.CurrentNode);
                    }
                    if ((index != num2) && (list.Count != 0))
                    {
                        list.RemoveAt(num6);
                        int num13 = this.tgdvTest.CurrentNode.Index;
                        if (list.Count != 0)
                        {
                            this.tgdvTest.CurrentNode.Parent.Nodes.Clear();
                        }
                        if (num13 != 0)
                        {
                            this.tgdvTest.Nodes[0].Nodes[this.tgdvTest.CurrentNode.Parent.Index].Expand();
                        }
                        for (num4 = 0; num4 < list.Count; num4++)
                        {
                            wlInfo info2 = list[num4];
                            int num14 = this.tgdvTest.CurrentNode.Index;
                            TreeGridNode node = this.tgdvTest.Nodes[0].Nodes[num7 - num10].Nodes.Add(new object[] { info2.proName, info2.danWei, double.Parse(info2.price.ToString()).ToString("f2"), double.Parse(info2.num.ToString()).ToString("f2"), double.Parse(info2.priceCount.ToString()).ToString("f2"), info2.GYdo, "" });
                            node.ImageIndex = 0;
                            if (info2.GYdo.Trim().Equals(""))
                            {
                                node.Tag = "";
                                node.Cells[0].ReadOnly = true;
                                node.Cells[1].ReadOnly = true;
                                node.Cells[2].ReadOnly = true;
                                node.Cells[5].ReadOnly = true;
                            }
                            else
                            {
                                node.Tag = "fj";
                                node.Cells[1].ReadOnly = false;
                                node.Cells[2].ReadOnly = false;
                                node.Cells[5].ReadOnly = false;
                            }
                        }
                    }
                }
            }
            catch (Exception)
            {
            }
        }

        private void 添加施工单元ToolStripMenuItem_Click(object sender, EventArgs e)
        {
            int num = 0;
            if (this.tgdvTest.CurrentNode.Level == 2)
            {
                List<jzgl.Model.BudgetInfo> itemNodes = this.GetItemNodes();
                List<BudgetDetails> budgetDetailsNodes = this.GetBudgetDetailsNodes();
                jzgl.Model.BudgetInfo item = new jzgl.Model.BudgetInfo();
                item._BudInfoName = "新单元";
                item._BudInfoPrice = float.Parse("0.00");
                int budInfoNodeId = 0;
                if (this.tgdvTest.Nodes[0].Nodes.Count != 0)
                {
                    if (this.tgdvTest.Nodes[0].Nodes.Count == 1)
                    {
                        budInfoNodeId = itemNodes[0].BudInfoNodeId;
                    }
                    else
                    {
                        budInfoNodeId = itemNodes[1].BudInfoNodeId;
                    }
                }
                else
                {
                    budInfoNodeId = itemNodes[this.tgdvTest.CurrentNode.Index].BudInfoNodeId;
                }
                int num3 = this.tgdvTest.CurrentNode.Index - budInfoNodeId;
                num = num3 + 1;
                itemNodes.Insert(num3 + 1, item);
                this.tgdvTest.Nodes[0].Nodes.Clear();
                for (int i = 0; i < itemNodes.Count; i++)
                {
                    jzgl.Model.BudgetInfo info2 = itemNodes[i];
                    TreeGridNode node = this.tgdvTest.Nodes[0].Nodes.Add(new object[] { info2._BudInfoName, "", "", "", info2._BudInfoPrice, "", i });
                    for (int j = 0; j < budgetDetailsNodes.Count; j++)
                    {
                        BudgetDetails details = budgetDetailsNodes[j];
                        if (info2._BudInfoName.Equals(details.ParentBudName) && (i != num))
                        {
                            TreeGridNode node2 = this.tgdvTest.Nodes[0].Nodes[i].Nodes.Add(new object[] { details._BudDetName, details._BudDetUnit, double.Parse(details._BudDetPrice.ToString()).ToString("f2"), details._BudDetNum, double.Parse(details._BudDetSum.ToString()).ToString("f2"), details._BudDetTech, "" });
                            node2.ImageIndex = 0;
                            node2.Tag = details._BudDetRemark;
                            node2.Cells[0].ReadOnly = true;
                        }
                    }
                    this.bz = 1;
                    node.Cells[0].ReadOnly = true;
                    node.Cells[1].ReadOnly = true;
                    node.Cells[2].ReadOnly = true;
                    node.Cells[3].ReadOnly = true;
                    node.Cells[4].ReadOnly = true;
                    node.Cells[5].ReadOnly = true;
                    node.Cells[6].ReadOnly = true;
                    node.ImageIndex = 2;
                    node.Cells[4].Style.ForeColor = Color.Blue;
                    node.Cells[0].Style.BackColor = Color.LightGray;
                    node.Cells[1].Style.BackColor = Color.LightGray;
                    node.Cells[2].Style.BackColor = Color.LightGray;
                    node.Cells[3].Style.BackColor = Color.LightGray;
                    node.Cells[4].Style.BackColor = Color.LightGray;
                    node.Cells[5].Style.BackColor = Color.LightGray;
                    node.Cells[6].Style.BackColor = Color.LightGray;
                }
                this.tgdvTest.Nodes[0].Nodes[num].Cells[0].ReadOnly = false;
                this.tgdvTest.CurrentCell = this.tgdvTest.Nodes[0].Nodes[num].Cells[0];
                this.Adds++;
                if (this.Adds <= this.delCount)
                {
                    this.delCount--;
                }
                this.AddNO = 1;
                this.save_sore.Clear();
            }
        }

        private void 修改单元格名称ToolStripMenuItem_Click(object sender, EventArgs e)
        {
            if (this.tgdvTest.CurrentNode.Level == 2)
            {
                this.er = this.tgdvTest.CurrentNode.Index;
                this.tgdvTest.CurrentNode.Cells[0].ReadOnly = false;
            }
        }

        private void 选择施工项目ToolStripMenuItem_Click(object sender, EventArgs e)
        {
            if (this.tgdvTest.CurrentNode.Level == 2)
            {
                this.splitContainer1.Panel1Collapsed = false;
                this.splitContainer1.Panel2Collapsed = false;
            }
        }

        private void 粘贴单元项目ToolStripMenuItem_Click(object sender, EventArgs e)
        {
            float num;
            int num2;
            MaterInfo info;
            TreeGridNode node;
            if (this.tgdvTest.CurrentNode.Level == 2)
            {
                num = 0f;
                if (this.materList == null)
                {
                    MessageBox.Show("没有数据可以粘贴！", "提示", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
                    return;
                }
                for (num2 = 0; num2 < this.materList.Count; num2++)
                {
                    info = this.materList[num2];
                    node = this.tgdvTest.CurrentNode.Nodes.Add(new object[] { info._MaterInfoName, info._MaterUnit, double.Parse(info._MaterPrice).ToString("f2"), double.Parse(info.Num.ToString()).ToString("f2"), double.Parse(info.TotalPrice).ToString("f2"), info._MaterTech, "" });
                    node.ImageIndex = 0;
                    if (info._MaterRemark.Trim().Equals(""))
                    {
                        node.Tag = "";
                        node.Cells[0].ReadOnly = true;
                        node.Cells[1].ReadOnly = true;
                        node.Cells[2].ReadOnly = true;
                        node.Cells[5].ReadOnly = true;
                    }
                    else
                    {
                        node.Tag = "fj";
                        node.Cells[1].ReadOnly = false;
                        node.Cells[2].ReadOnly = false;
                        node.Cells[5].ReadOnly = false;
                    }
                    num += float.Parse(info.TotalPrice);
                    this.tgdvTest.CurrentNode.Expand();
                }
                this.tgdvTest.Nodes[0].Cells[4].Value = float.Parse(this.tgdvTest.Nodes[0].Cells[4].Value.ToString().Trim()) + num;
                num += float.Parse(this.tgdvTest.CurrentNode.Cells[4].Value.ToString().Trim());
                this.tgdvTest.CurrentNode.Cells[4].Value = num;
            }
            if (this.tgdvTest.CurrentNode.Level == 3)
            {
                num = 0f;
                if (this.copy[0].Equals(""))
                {
                    MessageBox.Show("没有数据可以粘贴！", "提示", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
                    this.copy[7] = "";
                }
                else
                {
                    List<MaterInfo> list = new List<MaterInfo>();
                    for (num2 = 0; num2 < this.tgdvTest.CurrentNode.Parent.Nodes.Count; num2++)
                    {
                        info = new MaterInfo();
                        info._MaterInfoName = this.tgdvTest.CurrentNode.Parent.Nodes[num2].Cells[0].Value.ToString();
                        info._MaterUnit = this.tgdvTest.CurrentNode.Parent.Nodes[num2].Cells[1].Value.ToString();
                        info._MaterPrice = this.tgdvTest.CurrentNode.Parent.Nodes[num2].Cells[2].Value.ToString();
                        info.Num = this.tgdvTest.CurrentNode.Parent.Nodes[num2].Cells[3].Value.ToString();
                        info.TotalPrice = this.tgdvTest.CurrentNode.Parent.Nodes[num2].Cells[4].Value.ToString();
                        info._MaterTech = this.tgdvTest.CurrentNode.Parent.Nodes[num2].Cells[5].Value.ToString();
                        info._MaterRemark = this.tgdvTest.CurrentNode.Parent.Nodes[num2].Tag.ToString();
                        list.Add(info);
                    }
                    MaterInfo item = new MaterInfo();
                    item._MaterInfoName = this.copy[0];
                    item._MaterUnit = this.copy[1];
                    item._MaterPrice = this.copy[2];
                    item.Num = this.copy[3];
                    item.TotalPrice = this.copy[4];
                    item._MaterTech = this.copy[5];
                    item._MaterRemark = this.copy[7];
                    num = float.Parse(this.copy[4]);
                    this.tgdvTest.Nodes[0].Cells[4].Value = float.Parse(this.tgdvTest.Nodes[0].Cells[4].Value.ToString().Trim()) + num;
                    this.tgdvTest.CurrentNode.Parent.Cells[4].Value = float.Parse(this.tgdvTest.CurrentNode.Parent.Cells[4].Value.ToString().Trim()) + num;
                    int index = 0;
                    int num4 = 0;
                    for (num2 = 0; num2 < this.save_score1.Count; num2++)
                    {
                        if (this.tgdvTest.CurrentNode.Index > this.save_score1[num2])
                        {
                            num4++;
                        }
                    }
                    index = this.tgdvTest.CurrentNode.Index;
                    list.Insert(index + 1, item);
                    int num5 = 0;
                    if (this.AddNO == 1)
                    {
                        num5 = this.tgdvTest.CurrentNode.Parent.Index;
                    }
                    else
                    {
                        int num6 = 0;
                        if (this.tgdvTest.CurrentNode.Parent.Index != 0)
                        {
                            for (int i = 0; i < this.save_sore.Count; i++)
                            {
                                if (this.save_sore[i] < this.tgdvTest.CurrentNode.Parent.Index)
                                {
                                    num6++;
                                }
                            }
                            num5 = this.tgdvTest.CurrentNode.Parent.Index - num6;
                        }
                        else
                        {
                            num5 = this.tgdvTest.CurrentNode.Parent.Index;
                        }
                    }
                    this.tgdvTest.CurrentNode.Parent.Nodes.Clear();
                    for (num2 = 0; num2 < list.Count; num2++)
                    {
                        MaterInfo info3 = list[num2];
                        node = this.tgdvTest.Nodes[0].Nodes[num5].Nodes.Add(new object[] { info3._MaterInfoName, info3._MaterUnit, double.Parse(info3._MaterPrice).ToString("f2"), double.Parse(info3.Num.ToString()).ToString("f2"), double.Parse(info3.TotalPrice).ToString("f2"), info3._MaterTech, "" });
                        node.ImageIndex = 0;
                        if (info3._MaterRemark.Trim().Equals(""))
                        {
                            node.Tag = "";
                            node.Cells[0].ReadOnly = true;
                            node.Cells[1].ReadOnly = true;
                            node.Cells[2].ReadOnly = true;
                            node.Cells[5].ReadOnly = true;
                        }
                        else
                        {
                            node.Tag = "fj";
                            node.Cells[1].ReadOnly = false;
                            node.Cells[2].ReadOnly = false;
                            node.Cells[5].ReadOnly = false;
                        }
                    }
                    this.materList = null;
                    this.bz = 0;
                    this.copy[7] = "";
                }
            }
        }

        public string[] add_item
        {
            get
            {
                return this.item;
            }
            set
            {
                this.item = value;
            }
        }

        public string[] Auto_save_budget
        {
            get
            {
                return this.save_budget;
            }
            set
            {
                this.save_budget = value;
            }
        }

        public string HomeType
        {
            get
            {
                return this.lbl_HuXing.Text;
            }
            set
            {
                this.lbl_HuXing.Text = value;
            }
        }

        public List<BudgetDetails> ListBudgetDetailNodes
        {
            get
            {
                return this.GetBudgetDetailsNodes();
            }
            set
            {
                this.listBudgetDetailNodes = value;
            }
        }

        public List<jzgl.Model.BudgetInfo> ListNodes
        {
            get
            {
                return this.GetItemNodes();
            }
            set
            {
                this.listNodes = value;
            }
        }

        public int save_state
        {
            set
            {
                this.c = value;
            }
        }

        public float Total
        {
            get
            {
                return float.Parse(this.tgdvTest.Nodes[0].Cells[4].Value.ToString());
            }
            set
            {
                this.tgdvTest.Nodes[0].Cells[4].Value = value;
            }
        }

        internal class AttachmentColumnHeader : DataGridViewColumnHeaderCell
        {
            public Image _image;

            public AttachmentColumnHeader(Image img)
            {
                this._image = img;
            }

            protected override object GetValue(int rowIndex)
            {
                return null;
            }

            protected override void Paint(Graphics graphics, System.Drawing.Rectangle clipBounds, System.Drawing.Rectangle cellBounds, int rowIndex, DataGridViewElementStates dataGridViewElementState, object value, object formattedValue, string errorText, DataGridViewCellStyle cellStyle, DataGridViewAdvancedBorderStyle advancedBorderStyle, DataGridViewPaintParts paintParts)
            {
                base.Paint(graphics, clipBounds, cellBounds, rowIndex, dataGridViewElementState, value, formattedValue, errorText, cellStyle, advancedBorderStyle, paintParts);
                graphics.DrawImage(this._image, (int) (cellBounds.X + 4), (int) (cellBounds.Y + 2));
            }
        }
    }
}

